Mplot: Difference between revisions
imported>Jeremy (Importing text file) |
imported>Jeremy (Importing text file) |
||
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'') | ||
:[rows,cols] = mplot(rows,cols,''options'') | :[rows,cols] = mplot(rows,cols,''options'') | ||
:[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) | :mplot(4) | ||
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]) | :mplot([4 1]) | ||
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)) | :mplot(rand(100,3)) | ||
===Options=== | ===Options=== | ||
* '''center''': [ {'no'} | 'yes' ] governs centering of "left-over" plots at | * '''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, | * '''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 | ||
===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]] |
Revision as of 14:25, 3 September 2008
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
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.