CORNELL CS 100 - Matlab Graphics Legends

Unformatted text preview:

Matlab Graphics: LegendsNotes:Legends are useful for labelling complicated plots. Their location can becontrolled.Example Script:% Script File: ShowLegend% How to position a legend.loc={’North’,’South’,’East’,’West’,...’NorthEast’ , ’NorthWest’ , ’SouthEast’ , ’SouthWest’ ,...’NorthOutside’ , ’SouthOutside’ , ’EastOutside’ , ’WestOutside’ ,...’NorthEastOutside’ , ’NorthWestOutside’ , ’SouthEastOutside’ ,...’SouthWestOutside’ , ’Best’ , ’BestOutside’ };close allt = linspace(0,2);axis([0 2 -1.5 1.5])y1 = sin(t*pi);y2 = cos(t*pi);plot(t,y1,t,y2,’--’,[0.511.52],[00000],’o’)set(gca,’XTick’,[])set(gca,’YTick’,[0])grid onfor k=1:length(loc)legend(’sin(\pi t)’,’cos(\pi t)’,’roots’,’location’,loc{k})title(’ ’)title(loc{k},’FontSize’,14)pauseendSample Output:0NorthEast sin(π t)cos(π t)roots0SouthOutside sin(π t)cos(π t)roots0NorthEastOutside sin(π t)cos(π t)roots0SouthWestOutside sin(π t)cos(π t)roots0Best sin(π t)cos(π t)roots0BestOutside sin(π t)cos(π


View Full Document

CORNELL CS 100 - Matlab Graphics Legends

Download Matlab Graphics Legends
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Matlab Graphics Legends and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Matlab Graphics Legends 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?