100% found this document useful (1 vote)
216 views2 pages

Plotyy (MATLAB Functions)

The document describes the MATLAB function plotyy, which creates graphs with y-axes on both the left and right sides. It details the syntax, uses, and examples of plotyy.

Uploaded by

erik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
216 views2 pages

Plotyy (MATLAB Functions)

The document describes the MATLAB function plotyy, which creates graphs with y-axes on both the left and right sides. It details the syntax, uses, and examples of plotyy.

Uploaded by

erik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

plotyy (MATLAB Functions)

Documentation MATLAB MATLAB Functions

MATLAB Function Reference

plotyy
Create graphs with y axes on both left and right side

Syntax

plotyy(X1,Y1,X2,Y2)
plotyy(X1,Y1,X2,Y2,'function')
plotyy(X1,Y1,X2,Y2,'function1','function2')
[AX,H1,H2] = plotyy(...)

Description

plotyy(X1,Y1,X2,Y2) plots X1 versus Y1 with y-axis labeling on the left and plots X2 versus Y2 with y-axis labeling on
the right.

plotyy(X1,Y1,X2,Y2,'function') uses the plotting function specified by the string 'function' instead of plot to produce
each graph. 'function' can be plot, semilogx, semilogy, loglog, stem or any MATLAB function that accepts the syntax:

h = function(x,y)

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.

[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.

Examples

This example graphs two mathematical functions using plot as the plotting function. The two y-axes enable you to
display both sets of data on one graph even though relative values of the data are quite different.

x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
[AX,H1,H2] = plotyy(x,y1,x,y2,'plot');

You can use the handles returned by plotyy to label the axes and set the line styles used for plotting. With the axes
handles you can specify the YLabel properties of the left- and right-side y-axis:

set(get(AX(1),'Ylabel'),'String','Left Y-axis')
set(get(AX(2),'Ylabel'),'String','Right Y-axis')

Use the xlabel and title commands to label the x-axis and add a title:

xlabel('Zero to 20 \musec.')

http://www.mathworks.com/access/helpdesk_r13/help/techdoc/ref/plotyy.html (1 de 2) [20/05/2009 10:20:52 a.m.]


plotyy (MATLAB Functions)

title('Labeling plotyy')

Use the line handles to set the LineStyle properties of the left- and right-side plots:

set(H1,'LineStyle','--')
set(H2,'LineStyle',':')

See Also

plot, loglog, semilogx, semilogy, axes properties: XAxisLocation, YAxisLocation

The axes chapter in the Using MATLAB Graphics manual for information on multi-axis axes.

plotmatrix pol2cart

Learn more about the latest releases of MathWorks products:


Select an option

1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS

http://www.mathworks.com/access/helpdesk_r13/help/techdoc/ref/plotyy.html (2 de 2) [20/05/2009 10:20:52 a.m.]

You might also like