FUNCTION REFERENCE

yyaxis

Give the current axes a second y-axis on the right and choose the active side.

Give the current axes a second y-axis on the right and choose the active side.

Syntax

yyaxis left

Syntax

yyaxis right

Syntax

yyaxis(ax, side)

After yyaxis right, plot, ylim, ylabel and the YLim and YColor properties act on the right axis; yyaxis left switches back. Each side has its own limits and colour (the first and second ColorOrder colours), and a plot without hold replaces only the series of the active side. One legend lists the series of both sides.

Example

x = 1:10; yyaxis left; plot(x, x.^2); yyaxis right; plot(x, sqrt(x)); ylim([0 4]); r = ylim()   % [0 4]

Differences from MATLAB: Linear y-axes only. ax.YAxis rulers are not available; use YLim and YColor while the side is active. Both sides share one line-style cycle.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.