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.
grid |
Display or hide axes grid lines |
xticks |
Set or query x-axis tick values |
yticks |
Set or query y-axis tick values |
zticks |
Set or query z-axis tick values |
xticklabels |
Set or query x-axis tick labels |
yticklabels |
Set or query y-axis tick labels |
zticklabels |
Set or query z-axis tick labels |
xtickformat |
Specify x-axis tick label format |
ytickformat |
Specify y-axis tick label format |
ztickformat |
Specify z-axis tick label format |
xtickangle |
Rotate x-axis tick labels |
ytickangle |
Rotate y-axis tick labels |
ztickangle |
Rotate z-axis tick labels |
datetick |
Date formatted tick labels |
ruler2num |
Convert data from specific ruler to numeric data |
num2ruler |
Convert numeric data to use with specific ruler |
Axes Properties | Control axes appearance and behavior |
This example shows how to change the axis limits of a graph.
Specify Axis Tick Values and Labels
Customizing the tick labels along the x-axis and y-axis can help highlight particular aspects of your data.
Display Axis Lines Through Origin
This example shows how to create a plot and display the x-axis and y-axis lines so that they cross at the origin point (0,0).
This example shows how to add a plot to an existing graph.
Display Grid Lines on 2-D Graph
This example shows how to add major and minor grid lines to a graph and how to change the grid line style.
Create Figure with Multiple Axes Using Subplots
This example shows how to create a figure containing multiple axes using the subplot
function.
This example shows how to create a chart with y-axes on the left and right sides using the yyaxis
function.
Set Properties for Chart with Two y-Axes
The yyaxis
command creates an axes object with y-axes on the left and right sides.
Specify Colors for Chart with Two y-Axes
The yyaxis
command creates an axes object with y-axes on the left and right sides.
Graph with Multiple x-Axes and y-Axes
This example shows how to create a graph using the bottom and left sides of the axes for the first plot, and the top and right sides of the axes for the second plot.
Set the aspect ratio with the axis
function.
Automatically Calculated Properties
When plotting functions create graphs, many of the axes properties that are under automatic control adjust to best display the graph.
Axes Resize to Accommodate Titles and Labels
You can control which dimensions axes can change to accommodate the titles and labels by setting the appropriate properties.