MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics) MATLAB Function Reference (Volume 2: Graphics)

12.07.2015 Views

plotyyPurpose2plotyyCreate graphs with y axes on both left and right sideSyntaxDescriptionplotyy(X1,Y1,X2,Y2)plotyy(X1,Y1,X2,Y2,'function')plotyy(X1,Y1,X2,Y2,'function1','function2')[AX,H1,H2] = plotyy(...)plotyy(X1,Y1,X2,Y2) plots X1 versus Y1 with y-axis labeling on the left andplots X2 versus Y2 with y-axis labeling on the right.plotyy(X1,Y1,X2,Y2,'function') uses the plotting function specified by thestring 'function' instead of plot to produce each graph. 'function' can be plot,semilogx, semilogy, loglog, stem or any MATLAB function that accepts thesyntax:h = function(x,y)plotyy(X1,Y1,X2,Y2,'function1','function2') uses function1(X1,Y1) toplot the data for the left axis and function1(X2,Y2) to plot the data for theright axis.[AX,H1,H2] = plotyy(...) returns the handles of the two axes created in AXand the handles of the graphics objects from each plot in H1 and H2. AX(1) isthe left axes and AX(2) is the right axes.ExamplesCreate a graph using the plot function and two y-axes.t = 0:pi/20:2*pi;y1 = sin(t);y2 = 0.5*sin(t-1.5);plotyy(t,y1,t,y2,’plot’)2-362

plotyy10.500−10 1 2 3 4 5 6 7 −0.5See Alsoplot, loglog, semilogx, semilogy, axes properties: XAxisLocation,YAxisLocationThe axes chapter in the Using MATLAB Graphics manual for information onmulti-axis axes.2-363

plotyy10.500−10 1 2 3 4 5 6 7 −0.5See Alsoplot, loglog, semilogx, semilogy, axes properties: XAxisLocation,YAxisLocationThe axes chapter in the Using <strong>MATLAB</strong> <strong>Graphics</strong> manual for information onmulti-axis axes.2-363

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!