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, 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 visualization, 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 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.

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.

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.

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, 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

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. Drag the Time Plot icon from Visualizations and layouts onto the lower left subplot.

  3. Add the Actuator Model: 1 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:1 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 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.

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

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

  3. In the Limits section, change the y-axis limits of the Actuator Model: 1 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.

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.

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.

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.

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 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 Actuator Output.

See Also

| |

Related Topics