1 / 20

Lesson 6:

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, marker styles, line styles) 2) Matlab program for basic plots L6_plots.m

hung
Download Presentation

Lesson 6:

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 plotsL6_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) hold on plot(x(:,4),':ko','LineWidth',2) close all plot(x(:,3),'-md','LineWidth’ 2, 'MarkerEdgeColor’, 'k', 'MarkerFaceColor', 'g', 'MarkerSize', 10)

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

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

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

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

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

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

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

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

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

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

  15. Let’s look at the code 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’); What are we plotting? Is it a line? What color? Are there markers? Run the program and see if you were correct.

  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 How many figures were made when you ran the program? where are they? “pause” stops the program put a pause after each figure (copy and paste line 76) Save run the program

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

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

  20. Enjoy playing with Matlab plots!!!

More Related