Main Content

Simulink.sdi.setTicksPosition

Configure position for tick marks on time plots in the Simulation Data Inspector

Description

Simulink.sdi.setTicksPosition(position) sets the location of tick marks on time plots in the Simulation Data Inspector according to the input, position. The function configures the Ticks setting on the Time Plot section of the Visualization Settings in the Simulation Data Inspector. The setting applies to all time plots in the layout. By default, the Simulation Data Inspector displays tick marks on the outside of the plot area.

example

Examples

collapse all

You can use Simulink.sdi.setTicksPosition function to specify the position for tick marks on time plots in the Simulation Data Inspector. By default, the Simulation Data Inspector displays tick marks outside of the plot area for time plots.

This example starts by showing how to use the Simulink.sdi.getTicksPosition function to access the current position of tick marks. Subsequent sections show the code to specify each configuration option for the position of tick marks on time plots in the Simulation Data Inspector. To see the result, the example generates an image using Simulink.sdi.snapshot with settings specified by a Simulink.sdi.CustomSnapshot object.

snapSettings = Simulink.sdi.CustomSnapshot;
snapSettings.Width = 300;
snapSettings.Height = 300;

Get Current Tick Mark Position

Before modifying the position of tick marks on time plots, you can save the current configuration to a variable in the workspace in case you want to restore the preference later.

initTickPos = Simulink.sdi.getTicksPosition;

Position Tick Marks Inside Plot Area

Position the tick marks inside the plot area to increase the amount of space used by the plot area.

Simulink.sdi.setTicksPosition('inside')
Simulink.sdi.snapshot('from','custom','settings',snapSettings);

Figure contains an axes object. The hidden axes object contains an object of type image.

Hide Tick Marks on Time Plots

You can hide the tick marks for time plots in the Simulation Data Inspector. Hiding the tick marks expands the plot area.

Simulink.sdi.setTicksPosition('none')
Simulink.sdi.snapshot('from','custom','settings',snapSettings);

Figure contains an axes object. The hidden axes object contains an object of type image.

Position Tick Marks Outside Plot Area

By default, the Simulation Data Inspector displays tick marks outside of the plot area for time plots.

Simulink.sdi.setTicksPosition('outside')
Simulink.sdi.snapshot('from','custom','settings',snapSettings);

Figure contains an axes object. The hidden axes object contains an object of type image.

Input Arguments

collapse all

Position of tick marks on time plots in the Simulation Data Inspector, specified as 'inside' or 'outside'.

Tip

Move tick marks to the inside of time plots to increase the space available for the plot area.

Example: 'inside'

Version History

Introduced in R2019b