28.12.2012 Views

Figure Properties - SERC

Figure Properties - SERC

Figure Properties - SERC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

legend<br />

2-1296<br />

MATLAB displays only one legend per axes. legend positions the legend based<br />

on a variety of factors, such as what objects the legend obscures.<br />

legend installs a figure ResizeFcn, if there is not already a user-defined<br />

ResizeFcn assigned to the figure. This ResizeFcn attempts to keep the legend<br />

the same size.<br />

Moving the Legend<br />

You can move the legend by pressing the left mouse button while the cursor is<br />

over the legend and dragging the legend to a new location. Double-clicking a<br />

label allows you to edit the label.<br />

Examples Add a legend to a graph showing a sine and cosine function:<br />

x = pi:pi/20:pi;<br />

plot(x,cos(x),'-ro',x,sin(x),'-.b')<br />

h = legend('cos','sin',2);<br />

1<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

−0.2<br />

−0.4<br />

−0.6<br />

−0.8<br />

cos<br />

sin<br />

−1<br />

−4 −3 −2 −1 0 1 2 3 4

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

Saved successfully!

Ooh no, something went wrong!