Create chart with two y-axes
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.
When working with two y-axes, you cannot:
Rotate the axes (2-D view only).
Pin annotations.
Copy the axes object using copyobj
.
To determine which side of the axes is active, query
the YAxisLocation
property
for the Axes
object. The property is set to 'left'
when
the left side is active and 'right'
when the right
side is active. The YAxisLocation
property for
an Axes
object 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,
use cla reset
. Alternatively, you can wait to clear
both sides and remove the right y-axis until
the next plotting command by setting the NextPlot
property
of the Axes
object to 'replaceall'
.
The Children
property of the Axes
object
only contains the children for the active side. To access all the children for
both sides, use the allchild
function.