Main Content

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.

Add Visualizations

You can choose from several visualizations to use for your data in the Simulation Data Inspector.

IconVisualization NameDescription
Time Plot

Plot your signal data as a function of time. Time plots are the default visualization for each subplot.

Array

Plot multidimensional data including variable-sized signals.

For an example, see View Multidimensional Signals Using the Array Plot.

Map

Plot a route using longitude and latitude data on either a street or satellite view.

For an example, see View and Replay Map Data.

Sparklines

Plot many signals at once.

For an example, see View Many Signals Together Using Sparklines.

XY

Plot relationships between time-aligned signals.

For an example, see:

Text Editor

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.

The Visualizations and layouts menu

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.

The Visualization Gallery undocked from the Visualization and layouts menu/

You can also add a visualization to a subplot using the subplot menu.

  1. Pause on the subplot you wish to change. The name of the visualization currently in use appears with three dots.

  2. Click the three dots.

  3. Choose a visualization from the Change Visualization drop-down list.

The subplot menu being used to choose a visualization

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 1×1 to 8×8.

To change the layout, click Visualizations and layouts .

The Visualizations and layouts menu with only Grid and Basic Layouts expanded.

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 10, not 4. The number is 10 because in the largest possible 8×8 matrix, that subplot is numbered 10 when you count the subplots in a column-wise manner.

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 2 and 10.

In this three-subplot layout, the index for the right subplot is 9, and the indices for the two subplots on the left are 1 and 2.

For the Overlays layouts, the index for the main plot is always 1, and the indices for the overlaid plots are 2 and 9.

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 Stick, alpha, rad, and q, rad/sec signals.

Open the model, mark signals for logging, and run a simulation.

  1. Open the model.

  2. To log the output of the Actuator Model block and the q, rad/sec, the Stick, and the alpha, rad signals, select the signals in the model. Then, click Log Signals.

  3. Click the Data Inspector button to open the Simulation Data Inspector.

  4. Click Run to simulate the model.

The slexAircraftExample model

Add the 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.

The alpha, rad signal plotted on a time plot in the Simulation Data Inspector

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.

The alpha, rad signal and the Stick signal plotted in the Simulation Data Inspector

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:

  1. Click Preferences.

  2. Click the Inspect pane.

  3. In the Inspect - Selection section, select Do not scale axes limits when plotting new signals.

The Inspect pane of the Preferences dialog box

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:

  • Bullet points

  • Numbered lists

  • Hyperlinks

  • LaTeX equations

The Inspect pane of the Simulation Data Inspector shows two subplots aligned vertically. The alpha, rad and Stick signals are plotted in a time plot on the upper subplot. The lower subplot contains text describing the signals above.

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.

The context menu, opened by right-clicking the text editor subplot, is shown. The menu options are Change visualization, Clear subplot, Maximize, and Snapshot.

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.

  1. Click Visualizations and layouts . Then, from Basic Layouts, choose the layout with one large plot on top and two smaller plots below.

  2. Click or drag the Time Plot icon from Visualizations and layouts onto the lower left subplot.

  3. Add the Actuator Model signal to the lower left subplot by selecting the check box next to the signal name or by dragging the signal onto the plot.

  4. Add the q, rad/sec signal to the lower right subplot.

alpha, radand Stick are plotted in the large upper subplot while Actuator Model and q, rad/s are plotted in two lower subplots.

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 Visualization Settings menu is used to customize the appearance of subplots in the Simulation Data Inspector.

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 view the bottom graphs with the same y-axes, change the y-axis limits of the left graph to match those on the right.

  1. Select the q, rad/sec plot to view its y-axis limits in the Limits tab.

  2. Select the Actuator Model plot as the active plot.

  3. In the Limits section, change the y-axis limits of the Actuator Model plot to match the limits of the q, rad/sec plot.

The Visualization Settings menu is used to change the y-axis limits of the Actuator Model plot to match the limits of the q, rad/sec plot.

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 RGB values.

The line style menu

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.

  1. Click the Line column for the Stick signal.

  2. Select the dashed option.

  3. Click Set.

The line style of the Stick signal is dashed.

You can select easily distinguishable colors for all of the signals in your plot.

  1. Click the Line column for the alpha, rad signal.

  2. Specify the desired color. This example uses the dark blue in the standard palette.

  3. Click Set.

The line color of the alpha,rad signal is now dark blue.

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.

The Show/hide cursors menu

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.

The Cursor Options menu

For this example, in the Shading drop-down menu, select De-emphasize. In the Shade area drop-down menu, select Lead and lag. 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.

Two cursors are used to highlight the interval from 5.0 to 22.0. In all three subplots, the areas outside this interval are de-emphasized with gray shading.

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.

The Zoom menu

Then, click and drag to select a time span.

All three subplots zoomed into a smaller 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.

Rename Signals

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 buses or bus elements 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 signal to Actuator Output.

The name of the Actuator Model signal has been changed to Actuator Output in the signal table.

See Also

| |

Related Topics