Warning
This page is located in archive. Go to the latest version of this course pages.

General Instructions for Creating Graphs and Figures

Examples below can be generated by plot_example.m script in Tools repository.

  • Use subfig to place your figures reasonably. Note that a new figure is created each time, so don't forget to close your figures. Preferably close all at the beginning of your script.
  • Each figure should a have descriptive title.
  • When necessary, a legend describing lines of different colors/styles should be added, preferably inside the plot, if possible.

Figures with Bitmap Image Superimposed

  • Do not use imshow Matlab command for displaying bitmaps. Use image (or imagesc for grayscale bitmaps), then axes are kept shown.
  • Ensure square pixels: axis image (this hides area outside the image) or axis equal.
Example image

2D and 3D Euclidean Plots

  • Ensure equal axis scale: axis equal
  • Use labels for axes, e.g. xlabel( 'x' ), zlabel( 'z' )
Example 3D Plot

Plotting vectors

  • Use quiver and quiver3 to plot bound vectors in 2D/3D.
  • Use as quiver(X,Y,U,V,0) where X,Y is the origin and U,V the vector. The scaling argument 0 ensures the arrow is of the proper length.
Example vector plot

Other Graphs

  • Use labels for axes, e.g. xlabel( 'time [s]' ), ylabel( 'voltage [mV]' ). Don't forget units.
  • Use axis tight to set axis limits tightly to data.
Example graph.
courses/gvg/labs/gvg-hw-plotting.txt · Last modified: 2019/01/19 18:22 (external edit)