Create Plots Using the Simulation Data Inspector
Plots can help showcase important features or trends in your data and allow you to share your findings with others. The Simulation Data Inspector allows you to select from a variety of visualization types and layouts and customize plot and signal appearances to present your data most effectively.
You can choose from several visualizations to use for your data in the Simulation Data Inspector.
Plot your signal data as a function of time. Time plots are the default visualization for each subplot.
Plot multidimensional data including variable-sized signals.
For an example, see View Multidimensional Signals Using the Array Plot.
Plot a route using longitude and latitude data on either a street or satellite view.
For an example, see View and Replay Map Data.
Plot many signals at once.
For an example, see View Many Signals Together Using Sparklines.
Plot relationships between time-aligned signals.
For an example, see:
Add notes, observations, and conclusion to your data with a rich text editor.
To view available visualizations in the Simulation Data Inspector, click Visualizations and layouts . To add a visualization, click or drag the visualization icon onto the subplot.
When you have many subplots, you can open the Visualization Gallery in a separate window and reposition it with the plot area. Click Undock Visualization Gallery , then move the Visualization Gallery to a different location.
You can also add a visualization to a subplot using the subplot menu.
Pause on the subplot you wish to change. The name of the visualization currently in use appears with three dots.
Click the three dots.
Choose a visualization from the Change Visualization drop-down list.
Select Plot Layout
You can select from three types of layouts in the Simulation Data Inspector.
Basic Layouts offer templates for layouts including up to four subplots.
Overlays have overlay subplots in two corners of a main plot.
Grid layouts create a grid of subplots according to dimensions you specify from
To change the layout, click Visualizations and layouts .
Moving Between Subplot Layouts
When you plot a signal on a subplot, the Simulation Data Inspector links the signal to the subplot, identifying the subplot with a number. As you move between subplot layouts, the association between the signal and subplot remains, even as the shape or visibility of the subplot may change.
Subplots of Grid layouts follow column-wise numbering, from
1 at the top left subplot to
8 in the
bottom left, to
64 at the bottom right. The number system is
fixed, regardless of which subplot configuration you select. For example, if you
display four subplots in a
2×2 configuration, the bottom right
subplot of the configuration is numbered
4. The number is
10 because in the largest
8×8 matrix, that subplot is numbered
10 when you count the subplots in a column-wise
Basic Layouts subplots also use the fixed
8×8 column-wise numbering as a base. For example, the top
plot in this three-subplot layout is subplot
1, and the two
subplots below it are
In this three-subplot layout, the index for the right subplot is
9, and the indices for the two subplots on the left are
For the Overlays layouts, the index for the main plot is
1, and the indices for the overlaid plots are
View Simulation Data Using Time Plot
This example shows how to plot time series data using the Simulation Data Inspector. Simulation data for this example is generated from a simulation of the
slexAircraftExample model that logs the output of the Actuator Model block and the
alpha, rad, and
q, rad/sec signals.
Open the model, mark signals for logging, and run a simulation.
Open the model.
To log the output of the Actuator Model block and the
q, rad/sec, the
Stick, and the
alpha, radsignals, select the signals in the model. Then, click Log Signals.
Click the Data Inspector button to open the Simulation Data Inspector.
Click Run to simulate the model.
alpha, rad signal to the time plot by selecting the check box next to the signal name or by dragging the signal onto the plot. By default, when you add a signal to an empty time plot, the Simulation Data Inspector performs a fit-to-view.
You can view more than one signal in a single time plot by selecting multiple check boxes. Add the
Stick signal to your time plot of the
alpha, rad signal.
By default, when a new signal is added to a non-empty time plot, the Simulation Data Inspector increases the y-axis limits if the range of the new signal is outside the current view. If the new signal is viewable in the current view, the y-axis limits do not change. You can set the axes not to scale when adding new signals to a plot:
Click the Inspect pane.
In the Inspect - Selection section, select Do not scale axes limits when plotting new signals.
Add Text to Plot Layout
You can use text to make the results of your data more clear. For example, add a text editor to your plot layout when you want to present conclusions, descriptions, or observations alongside your data. Try adding a text editor below your time series data. First, to add a subplot below the time plot, click Visualizations and layouts . Then, select the vertically aligned two-plot layout from Basic Layouts. Next, click or drag the Text Editor icon from the Visualizations and layouts menu onto the lower subplot.
The text editor includes a toolbar for rich text formatting, including:
To change the visualization, clear text, maximize the subplot, or take a snapshot:
Use the context menu by right-clicking the text editor subplot.
Use the subplot menu by clicking the three dots in the upper-right corner of the text editor.
Add Subplots to Visualize Data
Select the plot layout that best highlights the characteristics of your data. For example, with a basic three-plot layout, you can use the large plot to show a main result and show intermediate signals on the smaller plots.
Click Visualizations and layouts . Then, from Basic Layouts, choose the layout with one large plot on top and two smaller plots below.
Click or drag the Time Plot icon from Visualizations and layouts onto the lower left subplot.
Actuator Model: 1signal to the lower left subplot by selecting the check box next to the signal name or by dragging the signal onto the plot.
q, rad/secsignal to the lower right subplot.
Customize Time Plot Appearance
After you choose a plot layout, you can customize the appearance of each visualization. To view customization options, click Visualization Settings . The menu tabs correspond to the visualizations in your layout.
You can customize the appearance of time plots in the Simulation Data Inspector, including choosing custom colors, choosing to show or hide attributes such as the grid or legend, and specifying axes limits. To maximize the area in the visualization available for the plot, you can move the tick marks, tick mark labels, and legend inside the plot or hide them.
The Limits section gives you control over the limits of the t- and y-axes. You may also choose to normalize the y-axis. Except for the t-axis limits, the settings you configure in the Limits section apply to the active subplot. To configure t-axis limits individually for a subplot, unlink the subplot. For more information, see Linked Subplots.
To improve the plot you created in the previous section, change the y-axis limits of the left graph to match those on the right.
q, rad/secplot to view its y-axis limits in the Limits tab.
Actuator Model: 1plot as the active plot.
In the Limits section, change the y-axis limits of the
Actuator Model: 1plot to match the limits of the
Customize Signal Appearance
The Simulation Data Inspector allows you to modify the color, style, and line width of
each signal. You can select a signal color from a palette of standard colors or specify
a custom color with
You can access the line style menu for a signal in the Simulation Data Inspector or in the Simulink® Editor:
In the Simulation Data Inspector, click the graphic representation in the Line column of the work area or the Line row in the Properties pane.
From the Simulink Editor, right-click the logging badge for a signal, and select Properties to open the Instrumentation Properties for the signal. Then, click the graphic representation of the Line.
From the Instrumentation Properties, you can also select subplots where you want to plot the signal. Changes made through the Instrumentation Properties take effect for subsequent simulations.
If a signal is connected to a Dashboard Scope block, you can also modify the signal line style and color using the Block Parameters dialog box. Changes to line style and color made in the Simulink Editor remain consistent for a signal. When you change the line style and color in the Simulation Data Inspector, the signal line style and color do not change in the Simulink Editor.
Line style customization can help emphasize differences between signals in your plot.
For example, change the line style of the
Stick signal to dashed to
visually indicate that it is an ideal, rather than simulated, signal.
Click the Line column for the
Select the dashed option.
You can select easily distinguishable colors for all of the signals in your plot.
Click the Line column for the
Specify the desired color. This example uses the dark blue in the standard palette.
Shade Signal Regions
You can shade an area of a time plot to draw attention to a region of interest in the plotted data. For example, you can highlight the area around a signal transition. First, add two cursors to the plot area by clicking the arrow next to the Show/hide cursors button and selecting Two Cursors.
Next, click the arrow again and select Cursor Options. You can specify whether to emphasize or de-emphasize the shaded area, the area to shade relative to the cursors, and the shading color and opacity. You can specify separate color and opacity settings for the Emphasize and De-emphasize options.
For this example, select the De-emphasize and Lead and lag options. Close the Cursor Options menu. The gray shading obscures the area outside of the cursors and highlights the signal region between the cursors. Move the cursors to highlight an area of interest, like the first rising edge of the waveform.
You can use the Zoom in Time option to zoom in synchronously on the region of interest. Select Zoom in Time from the Zoom In menu.
Then, click and drag to select a time span.
You can use the Snapshot menu to save snapshots of highlighted signal regions. For more information, see Save and Share Simulation Data Inspector Data and Views.
You can rename signals in the Simulation Data Inspector when a more descriptive name can help convey information. Changing a signal name in the Simulation Data Inspector does not affect signal names used in models. You cannot rename bus signals in the Simulation Data Inspector.
To change a signal name, double-click the signal name in the work area or archive, or
edit the Name field in the Properties pane.
Change the name of the
Actuator Model: 1 signal to