(Not recommended) Create graph with two y-axes
plotyy is not recommended. Use yyaxis instead. For more information, see Compatibility Considerations.
plotyy(X1,Y1,X2,Y2)
plotyy(X1,Y1,X2,Y2,function)
plotyy(X1,Y1,X2,Y2,'function1','function2')
plotyy(AX1,___)
[AX,H1,H2] = plotyy(___)
plotyy(X1,Y1,X2,Y2) plots
Y1 versus X1 with y-axis
labeling on the left and plots Y2 versus X2 with
y-axis labeling on the right.
plotyy(X1,Y1,X2,Y2,function) uses the
specified plotting function to produce the graph.
function can be either a function handle or a character vector
specifying plot, semilogx, semilogy, loglog, stem, or any MATLAB® function that accepts the syntax
h = function(x,y)
For example,
plotyy(x1,y1,x2,y2,@loglog) % function handle plotyy(x1,y1,x2,y2,'loglog') % character vector
Function handles enable you to access user-defined local functions and can provide other advantages. For more information on using function handles, see Create Function Handle.
plotyy(X1,Y1,X2,Y2,'function1','function2')
uses function1(X1,Y1) to plot the data for the left axis and
function2(X2,Y2) to plot the data for the right axis.
plotyy(AX1,___) plots the data
using the axes specified by AX1 for the first set of data, instead of
using the current axes. Specify AX1 as a single axes object or a
vector of the two axes objects returned by a previous call to plotyy.
If you specify a vector, then plotyy uses the first axes object in
the vector. Use this option with any of the input argument combinations in the previous
syntaxes.
[AX,H1,H2] = plotyy(___) returns
the handles of the two axes created in AX and the handles of the
graphics objects from each plot in H1 and H2.
AX(1) is the left axes and AX(2) is the right
axes.