Main Content

StackedAxesProperties属性

Appearance and behavior of individual axes in stacked plot

StackedAxesPropertiesproperties control the appearance and behavior of individualy-axes in astacked plot. In a stacked plot, you can plot the variables of a table or timetable, or the columns of a matrix, in separatey-axes, stacked vertically. By changing property values, you can modify certain aspects of the stacked plot.

Thestackedplotfunction returns aStackedLineChartobject. In turn, this object has an array ofStackedAxesPropertiesobjects, namedAxesProperties. To set properties of an individualy-axis, index intoAxesPropertiesand access properties of the corresponding object.

You can use dot notation to query and set properties. For example, changey-limits of the third plot using itsYLimitsproperty.

T = readtable('outages.csv'); s = stackedplot(T); c = s.AxesProperties(3).YLimits s.AxesProperties(3).YLimits = [0 1e6];

Minimum and maximumy-axis limits, specified as a two-element vector of the form[min max], wheremaxis greater thanmin. You can specify the limits as numeric, categorical, datetime, or duration values. However, the type of values that you specify must match the type of values along the axis.

You can specify both limits or you can specify one limit and let the axes automatically calculate the other. For an automatically calculated minimum or maximum limit, use-inforinf, respectively.

Example:s.AxesProperties(3)。YLimits = [0 1 e6)

Example:s.AxesProperties(3)。YLimits = [-inf 1e6]

Example:s.AxesProperties(3)。YLimits = [0 inf]

Data Types:double|single|int8|int16|int32|int64|uint8|uint16|uint32|uint64|categorical|datetime|duration

Linear or log scale for they-axis, specified as'linear'or'log'.

Example:s.AxesProperties(3)。YScale = 'log'

Legend labels, specified as a cell array of character vectors or string array. If you do not specify labels, then the labels are variable names (for tables and timetables) or'ColumnN'(for theNth column of a matrix).

Legends do not display unless theLegendVisibleproperty is set to'on'.

Example:s.AxesProperties(1).LegendLabels = {'Label Text'}

Location with respect to the axes, specified as one of the location values listed in this table.

Value Description
'north' Inside top of axes
'south' Inside bottom of axes
'east' Inside right of axes
'west' Inside left of axes
'northeast' Inside top-right of axes (default for 2-D axes)
'northwest' Inside top-left of axes
'southeast' Inside bottom-right of axes
'southwest' Inside bottom-left of axes

Example:s.AxesProperties(2).LegendLocation = 'southeast'

State of legend visibility, specified as'on'or'off'. SetLegendVisibleto'on'to display the legend or'off'to hide the legend.

Example:s.AxesProperties(3)。LegendVisible = 'on'

Version History

Introduced in R2018b