Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 6: basic plots. Lesson 6 Outline: Plot 1-basic plot commands 1) Figure Line style Marker style Labels and Titles Axes Matlab help LineSpec (colors,

Similar presentations


Presentation on theme: "Lesson 6: basic plots. Lesson 6 Outline: Plot 1-basic plot commands 1) Figure Line style Marker style Labels and Titles Axes Matlab help LineSpec (colors,"— Presentation transcript:

1 Lesson 6: basic plots

2 Lesson 6 Outline: Plot 1-basic plot commands 1) Figure Line style Marker style Labels and Titles Axes Matlab help LineSpec (colors, marker styles, line styles) 2) Matlab program for basic plots L6_plots.m line plots: 1D with time Multiple data sets 1D across time scatter plots: 2D bar plots : Hx 3) Subplots 4) Managing plots visible off pause saveas 5 ) Play with zoom

3 x=rand(20,10); figure plot(x(:,10)) plot(x(:,9)) hold on plot(x(:,10),’r’)

4 figure plot(x(:,5),'--b','LineWidth',2) plot(x(:,4),':ko','LineWidth',2) hold on plot(x(:,3),'-md','LineWidth’ 2, 'MarkerEdgeColor’, 'k', 'MarkerFaceColor', 'g', 'MarkerSize', 10) close all

5 MatLab help search  LineSpec colors line styles marker styles 5 minutes to play

6 xlabel(‘time') axis([xmin xmax ymin ymax]) title(’random x plot') ylabel(’column_5') axis([1 25 -1 1])

7 Uncomment the next plot command L6_plots.m highlight lines 35-45 open the m file from your current directory right click and “uncomment” save run the program

8 What are we plotting? Let’s look at the code Run the program and see if you were correct. Is it a line? What color? Are there markers? plot(x,'b') hold on plot(y,'r') hold on

9 Uncomment the next plot command highlight lines 48-54 right click and “uncomment” save

10 What are we plotting? Let’s look at the code Run the program and see if you were correct. Is it a line? What color? Are there markers? plot(x,y,'b*');

11 Uncomment the next plot command highlight lines 58-61 right click and “uncomment” save

12 What are we plotting? Let’s look at the code Run the program and see how it looks. Is it a line? What color? Are there markers? hist(z) In command window type help hist

13 What is the default bin size? hist(z,25) hist(z,50) Try changing the bin size

14 Uncomment the next plot command highlight lines 65-72 right click and “uncomment” save

15 What are we plotting? Let’s look at the code Run the program and see if you were correct. Is it a line? What color? Are there markers? subplot(3,2,1);plot(x,’r’); subplot(3,2,2);plot(y,’b’); subplot(3,2,3);plot(x2,’-rd’); subplot(3,2,4);plot(y2,’:mo’); subplot(3,2,5);plot(x3,’- -k’); subplot(3,2,6);plot(y3, ‘-.g’);

16 subplot(3,2,1); subplot(3,2,2); subplot(3,2,3); subplot(3,2,4); subplot(3,2,5); subplot(3,2,6); 3 rows 2 columns 6 plots

17 Managing figures where are they? stops the program put a pause after each figure (copy and paste line 76) Save run the program How many figures were made when you ran the program? “pause”

18 What if you do not want to see the figures? How can you save them to a file? creating a figure “handle” saveas(fig_x,[outpath,’xy_scatter.tif’]); copy and paste line 77 adjust figure “handle” and name of file set(fig_x,’visible’,’off’)’; copy and paste line 75 adjust figure “handle” for this line fig_x=figure; % pause be sure to comment out the pauses

19 Select area you want enlarged Using zoom on Matlab plots Save as Click on zoom at top of figure + +

20 Enjoy playing with Matlab plots!!!


Download ppt "Lesson 6: basic plots. Lesson 6 Outline: Plot 1-basic plot commands 1) Figure Line style Marker style Labels and Titles Axes Matlab help LineSpec (colors,"

Similar presentations


Ads by Google