Main Content

Axes Appearance

Modify axis limits and tick values, add grid lines, combine multiple plots

You can customize axes by changing the limits, controlling the locations of the tick marks, formatting the tick labels, or adding grid lines. You also can combine multiple plots, either using separate axes in the same figure, or by combining the plots in the same axes, with the option to add a second y-axis.

Functions

expand all

Limits

xlimSet or query x-axis limits
ylimSet or query y-axis limits
zlimSet or query z-axis limits

Scale

xscaleSet or query x-axis scale (linear or logarithmic) (Since R2023b)
yscaleSet or query y-axis scale (linear or logarithmic) (Since R2023b)
zscaleSet or query z-axis scale (linear or logarithmic) (Since R2023b)

Plot Box and Aspect Ratio

boxDisplay axes outline
tightPositionPosition of axes plotting area (Since R2022b)
axisSet axis limits and aspect ratios
daspectControl data unit length along each axis
pbaspectControl relative lengths of each axis

Tick Values

xticksSet or query x-axis tick values
yticksSet or query y-axis tick values
zticksSet or query z-axis tick values
xtickformatSpecify x-axis tick label format
ytickformatSpecify y-axis tick label format
ztickformatSpecify z-axis tick label format
ruler2numConvert data from specific ruler to numeric data
num2rulerConvert numeric data for use with specific ruler

Grid Lines and Tick Marks

gridDisplay or hide axes grid lines
xtickangleRotate x-axis tick labels
ytickangleRotate y-axis tick labels
ztickangleRotate z-axis tick labels

Labels

xticklabelsSet or query x-axis tick labels
yticklabelsSet or query y-axis tick labels
zticklabelsSet or query z-axis tick labels
xsecondarylabelSet x-axis secondary label (Since R2023b)
ysecondarylabelSet y-axis secondary label (Since R2023b)
zsecondarylabelSet z-axis secondary label (Since R2023b)

Combining Plots

holdRetain current plot when adding new plots
yyaxisCreate chart with two y-axes
legendAdd legend to axes

Customizing Multiple Data Series

colororderSet or query color order palette
orderedcolorsColor palettes for visualizing multiple data series (Since R2023b)
linestyleorderSet or query line style order (Since R2024a)

Tiling Plots

tiledlayoutCreate tiled chart layout for displaying subplots
nexttileCreate axes in tiled chart layout
tilenumTile location numbers in tiled chart layout (Since R2022b)
tilerowcolRow and column numbers in tiled chart layout (Since R2022b)
subplotCreate axes in tiled positions
claClear axes
clfClear figure
axesCreate Cartesian axes
figureCreate figure window

Properties

Axes Properties Axes appearance and behavior
Legend PropertiesLegend appearance and behavior
TiledChartLayout PropertiesTiled chart layout appearance and behavior

Topics

Limits, Ticks, and Grids

Multiple Plots

Size and Aspect Ratio