Mplot: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
imported>Donal
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
===Purpose===
===Purpose===
Automatic creation of subplots and plotting.
Automatic creation of subplots and plotting.
===Synopsis===
===Synopsis===
:[rows,cols] = mplot(n,''options'')
:[rows,cols] = mplot(n,''options'')
:[rows,cols] = mplot([rows cols],''options'')
:[rows,cols] = mplot([rows cols],''options'')
Line 7: Line 10:
:[rows,cols] = mplot(y,''options'')
:[rows,cols] = mplot(y,''options'')
:[rows,cols] = mplot(x,y,''options'')
:[rows,cols] = mplot(x,y,''options'')
===Description===
===Description===
Inputs can be one of four forms:
Inputs can be one of four forms:
(1) the number of subplots requested n, "best fit" onto the figure
(1) the number of subplots requested n, "best fit" onto the figure
(2) the number of rows and columns for the subplot array [rows cols]
(2) the number of rows and columns for the subplot array [rows cols]
(3) or data to plot y with or without reference data for the x-axis x. Each column of y is plotted in a single subplot on the figure.
(3) or data to plot y with or without reference data for the x-axis x. Each column of y is plotted in a single subplot on the figure.
Outputs are the number of rows rows and columns cols used for the subplots.
Outputs are the number of rows rows and columns cols used for the subplots.
===Examples===
===Examples===
Example 1. To automatically create a "best fit" of four empty subplots
Example 1. To automatically create a "best fit" of four empty subplots
:mplot(4)
 
<pre>mplot(4)</pre>
 
Example 2. To automatically create four subplots in a 4 x 1 arrangement
Example 2. To automatically create four subplots in a 4 x 1 arrangement
:mplot([4 1])
 
<pre>mplot([4 1])</pre>
 
Example 3. To automatically plot three random columns, each in its own subplot
Example 3. To automatically plot three random columns, each in its own subplot
:mplot(rand(100,3))
 
<pre>mplot(rand(100,3))</pre>
 
===Options===
===Options===
* '''center''': [ {'no'} | 'yes' ] governs centering of "left-over" plots at
 
*        '''bottom''' of figure (when an uneven number of plots are to be fit onto the screen,
* '''center''': [ {'no'} | 'yes' ] governs centering of "left-over" plots at bottom of figure (when an uneven number of plots are to be fit onto the screen,
*    '''axismode''' :  [ {''} | 'tight' ] governs axis settings
 
*    '''axismode''' :  [ {''} | 'tight' ] governs axis settings,
 
*    '''plots''' :  [ 'none' | {'final'} ] governs creation of axes. If set to 'none', no axes are created and mplot only returns the rows and columns which would be used if axes were created.
 
===Algorithm===
===Algorithm===
When mplot is doing the "best fit", it attempts to keep the number of rows and columns as close as possible in size (Except for n=3 which is done as a 3x1 figure). Thus, the plot progression is: 1x1, 2x1, 3x1, 2x2, 3x2, 3x3, 4x3, etc.
When mplot is doing the "best fit", it attempts to keep the number of rows and columns as close as possible in size (Except for n=3 which is done as a 3x1 figure). Thus, the plot progression is: 1x1, 2x1, 3x1, 2x2, 3x2, 3x3, 4x3, etc.
===See Also===
===See Also===
[[plotgui]], [[subplot]]
[[plotgui]], [[subplot]]

Latest revision as of 21:16, 9 June 2014

Purpose

Automatic creation of subplots and plotting.

Synopsis

[rows,cols] = mplot(n,options)
[rows,cols] = mplot([rows cols],options)
[rows,cols] = mplot(rows,cols,options)
[rows,cols] = mplot(y,options)
[rows,cols] = mplot(x,y,options)

Description

Inputs can be one of four forms:

(1) the number of subplots requested n, "best fit" onto the figure

(2) the number of rows and columns for the subplot array [rows cols]

(3) or data to plot y with or without reference data for the x-axis x. Each column of y is plotted in a single subplot on the figure.

Outputs are the number of rows rows and columns cols used for the subplots.

Examples

Example 1. To automatically create a "best fit" of four empty subplots

mplot(4)

Example 2. To automatically create four subplots in a 4 x 1 arrangement

mplot([4 1])

Example 3. To automatically plot three random columns, each in its own subplot

mplot(rand(100,3))

Options

  • center: [ {'no'} | 'yes' ] governs centering of "left-over" plots at bottom of figure (when an uneven number of plots are to be fit onto the screen,
  • axismode : [ {} | 'tight' ] governs axis settings,
  • plots : [ 'none' | {'final'} ] governs creation of axes. If set to 'none', no axes are created and mplot only returns the rows and columns which would be used if axes were created.

Algorithm

When mplot is doing the "best fit", it attempts to keep the number of rows and columns as close as possible in size (Except for n=3 which is done as a 3x1 figure). Thus, the plot progression is: 1x1, 2x1, 3x1, 2x2, 3x2, 3x3, 4x3, etc.

See Also

plotgui, subplot