Plot2D:

Path: Common/Graphics

% Easily build a versatile 2D plot page consisting of any number of plots. 
 Data is indexed into a subplot grid and labels are applied automatically.
 The data series must be in rows. Any of the inputs, except y, may be
 omitted or [].

 The elements of iY indicate what rows of the y matrix should be plotted on 
 each subplot. If iY is not entered the number of y-axis labels will determine 
 the number of plots on the page. The number of rows of x must equal the number 
 of x labels. If you enter only one row of x it will be used for all plots 
 without the need to enter iX. Otherwise, the elements of iX indicate
 which rows of the x matrix should be used for each subplot.

 For example, to plot a position in a (3,n) matrix:

   Plot2D( t, r, 'Time', {'X','Y','Z'}, 'Position Vector' )

 or even just

   Plot2D( t, r )

 To plot this position overlaid with a target, 

   Plot2D(t,[r;rT],'Time',{'X','Y','Z'},'Position Vector',[],{'[1 4]','[2 5]','[3 6]'})

 This function has a built-in demo with 4 subplots showing indexing. Type
 Plot2D for the demo.
--------------------------------------------------------------------------
   Form:
   [h, hA] = Plot2D( x, y, xL, yL, figTitle, plotType, iY, iX, nCols, pThresh, figBackColor )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   x          (m,:)       x values
   y          (n,:)       y values
   xL       (m,:) or {m}  x-axis label(s)
   yL       (n,:) or {n}  y-axis label(s)
   figTitle    (:)        Figure title
   plotType (n,4) or {n}  Type of axes 'xlog', 'ylog', 'log', 'lin'. 'lin' is the default.
   iY       (n,:) or {n}  Index. Indexes Y data to plots. Each row or cell gives the indexes
                          of the data that go on that plot. This is a string,
                          either '[1 2 3 4]', '1:3', or an array.
   iX         (n,1)       Index. Indexes X data to plots. Each row gives the indexes
                          of the x data that goes with that plot.
   nCol       (1,1)       Number of columns.
   pThresh    (1,1)       Minimum plot resolution. Set to 2.220446049250313e-10 for PowerPC
                          Prevents a MATLAB warning that appears in V5.x.
   figBackColor (1)       Flag for fig background color (0 - grey, 1 - white)

   -------
   Outputs
   -------
   h          (1,1)       Figure handle
   hA         (:)         Data structure of handles to line objects
                          .h

--------------------------------------------------------------------------

Children:

Common: General/CellToMat
Common: General/MatToCell
Common: General/Watermark
Common: Graphics/PltStyle

Back to the Common Module page