Mplot
Contents |
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.