yyaxis
Create chart with two y-axes
Description
yyaxis left activates the side of the current axes associated with the
left y-axis. Subsequent graphics commands target the left
side. If the current axes do not include two y-axes, then
this command adds a second y-axis. If there are no axes,
then this command first creates them.
yyaxis right activates the side of the current axes associated with the
right y-axis. Subsequent graphics commands target the right
side.
Examples
Input Arguments
Limitations
When working with two y-axes, you cannot:
Rotate the axes (2-D view only).
Pin annotations.
Copy the axes object using
copyobj.
Tips
To determine which side of the axes is active, query the
YAxisLocationproperty for theAxesobject. The property is set to'left'when the left side is active and'right'when the right side is active. TheYAxisLocationproperty for anAxesobject with two y-axes is read only.To clear the active side, use
cla. To clear both sides of the axes and remove the right y-axis, usecla reset. Alternatively, you can wait to clear both sides and remove the right y-axis until the next plotting command by setting theNextPlotproperty of theAxesobject to'replaceall'.The
Childrenproperty of theAxesobject only contains the children for the active side. To access all the children for both sides, use theallchildfunction.
Algorithms
Version History
Introduced in R2016a








