The ‘plot’ function allows you to create simple x-y plots with linear
axes. For example,
x = -10:0.1:10;
plot (x, sin (x));
xlabel ("x");
ylabel ("sin (x)");
title ("Simple 2-D Plot");
displays a sine wave shown in Note: Figure 15.1. On most
systems, this command will open a separate plot window to display the
graph.
[image src="plot.png" text="
+---------------------------------+
| Image unavailable in text mode. |
+---------------------------------+" ]
Figure 15.1: Simple Two-Dimensional Plot.
-- : plot (Y)
-- : plot (X, Y)
-- : plot (X, Y, FMT)
-- : plot (..., PROPERTY, VALUE, ...)
-- : plot (X1, Y1, ..., XN, YN)
-- : plot (HAX, ...)
-- : H = plot (...)
Produce 2-D plots.
Many different combinations of arguments are possible. The
simplest form is
plot (Y)
where the argument is taken as the set of Y coordinates and the X
coordinates are taken to be the range ‘1:numel (Y)’.
If more than one argument is given, they are interpreted as
plot (Y, PROPERTY, VALUE, ...)
or
plot (X, Y, PROPERTY, VALUE, ...)
or
plot (X, Y, FMT, ...)
and so on. Any number of argument sets may appear. The X and Y
values are interpreted as follows:
• If a single data argument is supplied, it is taken as the set
of Y coordinates and the X coordinates are taken to be the
indices of the elements, starting with 1.
• If X and Y are scalars, a single point is plotted.
• ‘squeeze()’ is applied to arguments with more than two
dimensions, but no more than two singleton dimensions.
• If both arguments are vectors, the elements of Y are plotted
versus the elements of X.
• If X is a vector and Y is a matrix, then the columns (or rows)
of Y are plotted versus X. (using whichever combination
matches, with columns tried first.)
• If the X is a matrix and Y is a vector, Y is plotted versus
the columns (or rows) of X. (using whichever combination
matches, with columns tried first.)
• If both arguments are matrices, the columns of Y are plotted
versus the columns of X. In this case, both matrices must
have the same number of rows and columns and no attempt is
made to transpose the arguments to make the number of rows
match.
Multiple property-value pairs may be specified, but they must
appear in pairs. These arguments are applied to the line objects
drawn by ‘plot’. Useful properties to modify are "linestyle",
"linewidth", "color", "marker", "markersize", "markeredgecolor",
"markerfacecolor". Note: Line Properties.
The FMT format argument can also be used to control the plot style.
It is a string composed of four optional parts:
"<linestyle><marker><color><;displayname;>". When a marker is
specified, but no linestyle, only the markers are plotted.
Similarly, if a linestyle is specified, but no marker, then only
lines are drawn. If both are specified then lines and markers will
be plotted. If no FMT and no PROPERTY/VALUE pairs are given, then
the default plot style is solid lines with no markers and the color
determined by the "colororder" property of the current axes.
Format arguments:
linestyle
‘-’ Use solid lines (default).
‘--’ Use dashed lines.
‘:’ Use dotted lines.
‘-.’ Use dash-dotted lines.
marker
‘+’ crosshair
‘o’ circle
‘*’ star
‘.’ point
‘x’ cross
‘s’ square
‘d’ diamond
‘^’ upward-facing triangle
‘v’ downward-facing triangle
‘>’ right-facing triangle
‘<’ left-facing triangle
‘p’ pentagram
‘h’ hexagram
color
‘k’ blacK
‘r’ Red
‘g’ Green
‘b’ Blue
‘y’ Yellow
‘m’ Magenta
‘c’ Cyan
‘w’ White
";displayname;"
Here "displayname" is the label to use for the plot legend.
The FMT argument may also be used to assign legend labels. To do
so, include the desired label between semicolons after the
formatting sequence described above, e.g., "+b;Key Title;". Note
that the last semicolon is required and Octave will generate an
error if it is left out.
Here are some plot examples:
plot (x, y, "or", x, y2, x, y3, "m", x, y4, "+")
This command will plot ‘y’ with red circles, ‘y2’ with solid lines,
‘y3’ with solid magenta lines, and ‘y4’ with points displayed as
‘+’.
plot (b, "*", "markersize", 10)
This command will plot the data in the variable ‘b’, with points
displayed as ‘*’ and a marker size of 10.
t = 0:0.1:6.3;
plot (t, cos(t), "-;cos(t);", t, sin(t), "-b;sin(t);");
This will plot the cosine and sine functions and label them
accordingly in the legend.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a vector of graphics handles to the
created line objects.
To save a plot, in one of several image formats such as PostScript
or PNG, use the ‘print’ command.
See also: Note: axis, Note: box, *note grid:
XREFgrid, Note: hold, Note: legend, Note:
title, Note: xlabel, *note ylabel:
XREFylabel, Note: xlim, Note: ylim, Note:
ezplot, Note: errorbar, *note fplot:
XREFfplot, Note: line, Note: plot3, Note:
polar, Note: loglog, *note semilogx:
XREFsemilogx, Note: semilogy, *note subplot:
XREFsubplot.
The ‘plotyy’ function may be used to create a plot with two
independent y axes.
-- : plotyy (X1, Y1, X2, Y2)
-- : plotyy (..., FUN)
-- : plotyy (..., FUN1, FUN2)
-- : plotyy (HAX, ...)
-- : [AX, H1, H2] = plotyy (...)
Plot two sets of data with independent y-axes and a common x-axis.
The arguments X1 and Y1 define the arguments for the first plot and
X1 and Y2 for the second.
By default the arguments are evaluated with ‘feval (@plot, X, Y)’.
However the type of plot can be modified with the FUN argument, in
which case the plots are generated by ‘feval (FUN, X, Y)’. FUN can
be a function handle, an inline function, or a string of a function
name.
The function to use for each of the plots can be independently
defined with FUN1 and FUN2.
If the first argument HAX is an axes handle, then it defines the
principal axes in which to plot the X1 and Y1 data.
The return value AX is a vector with the axes handles of the two
y-axes. H1 and H2 are handles to the objects generated by the plot
commands.
x = 0:0.1:2*pi;
y1 = sin (x);
y2 = exp (x - 1);
ax = plotyy (x, y1, x - 1, y2, @plot, @semilogy);
xlabel ("X");
ylabel (ax(1), "Axis 1");
ylabel (ax(2), "Axis 2");
See also: Note: plot.
The functions ‘semilogx’, ‘semilogy’, and ‘loglog’ are similar to the
‘plot’ function, but produce plots in which one or both of the axes use
log scales.
-- : semilogx (Y)
-- : semilogx (X, Y)
-- : semilogx (X, Y, PROPERTY, VALUE, ...)
-- : semilogx (X, Y, FMT)
-- : semilogx (HAX, ...)
-- : H = semilogx (...)
Produce a 2-D plot using a logarithmic scale for the x-axis.
See the documentation of ‘plot’ for a description of the arguments
that ‘semilogx’ will accept.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a graphics handle to the created
plot.
See also: Note: plot, Note: semilogy, Note:
loglog.
-- : semilogy (Y)
-- : semilogy (X, Y)
-- : semilogy (X, Y, PROPERTY, VALUE, ...)
-- : semilogy (X, Y, FMT)
-- : semilogy (H, ...)
-- : H = semilogy (...)
Produce a 2-D plot using a logarithmic scale for the y-axis.
See the documentation of ‘plot’ for a description of the arguments
that ‘semilogy’ will accept.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a graphics handle to the created
plot.
See also: Note: plot, Note: semilogx, Note:
loglog.
-- : loglog (Y)
-- : loglog (X, Y)
-- : loglog (X, Y, PROP, VALUE, ...)
-- : loglog (X, Y, FMT)
-- : loglog (HAX, ...)
-- : H = loglog (...)
Produce a 2-D plot using logarithmic scales for both axes.
See the documentation of ‘plot’ for a description of the arguments
that ‘loglog’ will accept.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a graphics handle to the created
plot.
See also: Note: plot, Note: semilogx, Note:
semilogy.
The functions ‘bar’, ‘barh’, ‘stairs’, and ‘stem’ are useful for
displaying discrete data. For example,
randn ("state", 1);
hist (randn (10000, 1), 30);
xlabel ("Value");
ylabel ("Count");
title ("Histogram of 10,000 normally distributed random numbers");
produces the histogram of 10,000 normally distributed random numbers
shown in Note: Figure 15.2. Note that, ‘randn ("state", 1);’,
initializes the random number generator for ‘randn’ to a known value so
that the returned values are reproducible; This guarantees that the
figure produced is identical to the one in this manual.
[image src="hist.png" text="
+---------------------------------+
| Image unavailable in text mode. |
+---------------------------------+" ]
Figure 15.2: Histogram.
-- : bar (Y)
-- : bar (X, Y)
-- : bar (..., W)
-- : bar (..., STYLE)
-- : bar (..., PROP, VAL, ...)
-- : bar (HAX, ...)
-- : H = bar (..., PROP, VAL, ...)
Produce a bar graph from two vectors of X-Y data.
If only one argument is given, Y, it is taken as a vector of Y
values and the X coordinates are the range ‘1:numel (Y)’.
The optional input W controls the width of the bars. A value of
1.0 will cause each bar to exactly touch any adjacent bars. The
default width is 0.8.
If Y is a matrix, then each column of Y is taken to be a separate
bar graph plotted on the same graph. By default the columns are
plotted side-by-side. This behavior can be changed by the STYLE
argument which can take the following values:
"grouped" (default)
Side-by-side bars with a gap between bars and centered over
the X-coordinate.
"stacked"
Bars are stacked so that each X value has a single bar
composed of multiple segments.
"hist"
Side-by-side bars with no gap between bars and centered over
the X-coordinate.
"histc"
Side-by-side bars with no gap between bars and left-aligned to
the X-coordinate.
Optional property/value pairs are passed directly to the underlying
patch objects.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a vector of handles to the created
"bar series" hggroups with one handle per column of the variable Y.
This series makes it possible to change a common element in one bar
series object and have the change reflected in the other "bar
series". For example,
h = bar (rand (5, 10));
set (h(1), "basevalue", 0.5);
changes the position on the base of all of the bar series.
The following example modifies the face and edge colors using
property/value pairs.
bar (randn (1, 100), "facecolor", "r", "edgecolor", "b");
The color of the bars is taken from the figure’s colormap, such
that
bar (rand (10, 3));
colormap (summer (64));
will change the colors used for the bars. The color of bars can
also be set manually using the "facecolor" property as shown below.
h = bar (rand (10, 3));
set (h(1), "facecolor", "r")
set (h(2), "facecolor", "g")
set (h(3), "facecolor", "b")
See also: Note: barh, Note: hist, *note pie:
XREFpie, Note: plot, Note: patch.
-- : barh (Y)
-- : barh (X, Y)
-- : barh (..., W)
-- : barh (..., STYLE)
-- : barh (..., PROP, VAL, ...)
-- : barh (HAX, ...)
-- : H = barh (..., PROP, VAL, ...)
Produce a horizontal bar graph from two vectors of X-Y data.
If only one argument is given, it is taken as a vector of Y values
and the X coordinates are the range ‘1:numel (Y)’.
The optional input W controls the width of the bars. A value of
1.0 will cause each bar to exactly touch any adjacent bars. The
default width is 0.8.
If Y is a matrix, then each column of Y is taken to be a separate
bar graph plotted on the same graph. By default the columns are
plotted side-by-side. This behavior can be changed by the STYLE
argument which can take the following values:
"grouped" (default)
Side-by-side bars with a gap between bars and centered over
the Y-coordinate.
"stacked"
Bars are stacked so that each Y value has a single bar
composed of multiple segments.
"hist"
Side-by-side bars with no gap between bars and centered over
the Y-coordinate.
"histc"
Side-by-side bars with no gap between bars and left-aligned to
the Y-coordinate.
Optional property/value pairs are passed directly to the underlying
patch objects.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a graphics handle to the created bar
series hggroup. For a description of the use of the bar series,
Note: bar.
See also: Note: bar, Note: hist, *note pie:
XREFpie, Note: plot, Note: patch.
-- : hist (Y)
-- : hist (Y, NBINS)
-- : hist (Y, X)
-- : hist (Y, X, NORM)
-- : hist (..., PROP, VAL, ...)
-- : hist (HAX, ...)
-- : [NN, XX] = hist (...)
Produce histogram counts or plots.
With one vector input argument, Y, plot a histogram of the values
with 10 bins. The range of the histogram bins is determined by the
range of the data (difference between maximum and minimum value in
Y). Extreme values are lumped into the first and last bins. If Y
is a matrix then plot a histogram where each bin contains one bar
per input column of Y.
If the optional second argument is a scalar, NBINS, it defines the
number of bins.
If the optional second argument is a vector, X, it defines the
centers of the bins. The width of the bins is determined from the
adjacent values in the vector. The total number of bins is ‘numel
(X)’.
If a third argument is provided, the histogram is normalized such
that the sum of the bars is equal to NORM.
The histogram’s appearance may be modified by specifying
property/value pairs. For example, the face and edge color may be
modified:
hist (randn (1, 100), 25, "facecolor", "r", "edgecolor", "b");
The histogram’s colors also depend upon the current colormap.
hist (rand (10, 3));
colormap (summer ());
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
If an output is requested then no plot is made. Instead, return
the values NN (numbers of elements) and XX (bin centers) such that
‘bar (XX, NN)’ will plot the histogram.
See also: Note: histc, Note: bar, *note pie:
XREFpie, Note: rose.
-- : stemleaf (X, CAPTION)
-- : stemleaf (X, CAPTION, STEM_SZ)
-- : PLOTSTR = stemleaf (...)
Compute and display a stem and leaf plot of the vector X.
The input X should be a vector of integers. Any non-integer values
will be converted to integer by ‘X = fix (X)’. By default each
element of X will be plotted with the last digit of the element as
a leaf value and the remaining digits as the stem. For example,
123 will be plotted with the stem ‘12’ and the leaf ‘3’. The
second argument, CAPTION, should be a character array which
provides a description of the data. It is included as a heading
for the output.
The optional input STEM_SZ sets the width of each stem. The stem
width is determined by ‘10^(STEM_SZ + 1)’. The default stem width
is 10.
The output of ‘stemleaf’ is composed of two parts: a "Fenced Letter
Display," followed by the stem-and-leaf plot itself. The Fenced
Letter Display is described in ‘Exploratory Data Analysis’.
Briefly, the entries are as shown:
Fenced Letter Display
#% nx|___________________ nx = numel (x)
M% mi| md | mi median index, md median
H% hi|hl hu| hs hi lower hinge index, hl,hu hinges,
1 |x(1) x(nx)| hs h_spreadx(1), x(nx) first
_______ and last data value.
______|step |_______ step 1.5*h_spread
f|ifl ifh| inner fence, lower and higher
|nfl nfh| no.\ of data points within fences
F|ofl ofh| outer fence, lower and higher
|nFl nFh| no.\ of data points outside outer
fences
The stem-and-leaf plot shows on each line the stem value followed
by the string made up of the leaf digits. If the STEM_SZ is not 1
the successive leaf values are separated by ",".
With no return argument, the plot is immediately displayed. If an
output argument is provided, the plot is returned as an array of
strings.
The leaf digits are not sorted. If sorted leaf values are desired,
use ‘XS = sort (X)’ before calling ‘stemleaf (XS)’.
The stem and leaf plot and associated displays are described in:
Chapter 3, ‘Exploratory Data Analysis’ by J. W. Tukey,
Addison-Wesley, 1977.
See also: Note: hist, Note: printd.
-- : printd (OBJ, FILENAME)
-- : OUT_FILE = printd (...)
Convert any object acceptable to ‘disp’ into the format selected by
the suffix of FILENAME.
If the return argument OUT_FILE is given, the name of the created
file is returned.
This function is intended to facilitate manipulation of the output
of functions such as ‘stemleaf’.
See also: Note: stemleaf.
-- : stairs (Y)
-- : stairs (X, Y)
-- : stairs (..., STYLE)
-- : stairs (..., PROP, VAL, ...)
-- : stairs (HAX, ...)
-- : H = stairs (...)
-- : [XSTEP, YSTEP] = stairs (...)
Produce a stairstep plot.
The arguments X and Y may be vectors or matrices. If only one
argument is given, it is taken as a vector of Y values and the X
coordinates are taken to be the indices of the elements (‘X =
1:numel (Y)’).
The style to use for the plot can be defined with a line style
STYLE of the same format as the ‘plot’ command.
Multiple property/value pairs may be specified, but they must
appear in pairs.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
If one output argument is requested, return a graphics handle to
the created plot. If two output arguments are specified, the data
are generated but not plotted. For example,
stairs (x, y);
and
[xs, ys] = stairs (x, y);
plot (xs, ys);
are equivalent.
See also: Note: bar, Note: hist, *note plot:
XREFplot, Note: stem.
-- : stem (Y)
-- : stem (X, Y)
-- : stem (..., LINESPEC)
-- : stem (..., "filled")
-- : stem (..., PROP, VAL, ...)
-- : stem (HAX, ...)
-- : H = stem (...)
Plot a 2-D stem graph.
If only one argument is given, it is taken as the y-values and the
x-coordinates are taken from the indices of the elements.
If Y is a matrix, then each column of the matrix is plotted as a
separate stem graph. In this case X can either be a vector, the
same length as the number of rows in Y, or it can be a matrix of
the same size as Y.
The default color is "b" (blue), the default line style is "-", and
the default marker is "o". The line style can be altered by the
LINESPEC argument in the same manner as the ‘plot’ command. If the
"filled" argument is present the markers at the top of the stems
will be filled in. For example,
x = 1:10;
y = 2*x;
stem (x, y, "r");
plots 10 stems with heights from 2 to 20 in red;
Optional property/value pairs may be specified to control the
appearance of the plot.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a handle to a "stem series" hggroup.
The single hggroup handle has all of the graphical elements
comprising the plot as its children; This allows the properties of
multiple graphics objects to be changed by modifying just a single
property of the "stem series" hggroup.
For example,
x = [0:10]';
y = [sin(x), cos(x)]
h = stem (x, y);
set (h(2), "color", "g");
set (h(1), "basevalue", -1)
changes the color of the second "stem series" and moves the base
line of the first.
Stem Series Properties
linestyle
The linestyle of the stem. (Default: "-")
linewidth
The width of the stem. (Default: 0.5)
color
The color of the stem, and if not separately specified, the
marker. (Default: "b" [blue])
marker
The marker symbol to use at the top of each stem. (Default:
"o")
markeredgecolor
The edge color of the marker. (Default: "color" property)
markerfacecolor
The color to use for "filling" the marker. (Default: "none"
[unfilled])
markersize
The size of the marker. (Default: 6)
baseline
The handle of the line object which implements the baseline.
Use ‘set’ with the returned handle to change graphic
properties of the baseline.
basevalue
The y-value where the baseline is drawn. (Default: 0)
See also: Note: stem3, Note: bar, *note hist:
XREFhist, Note: plot, Note: stairs.
-- : stem3 (X, Y, Z)
-- : stem3 (..., LINESPEC)
-- : stem3 (..., "filled")
-- : stem3 (..., PROP, VAL, ...)
-- : stem3 (HAX, ...)
-- : H = stem3 (...)
Plot a 3-D stem graph.
Stems are drawn from the height Z to the location in the x-y plane
determined by X and Y. The default color is "b" (blue), the
default line style is "-", and the default marker is "o".
The line style can be altered by the LINESPEC argument in the same
manner as the ‘plot’ command. If the "filled" argument is present
the markers at the top of the stems will be filled in.
Optional property/value pairs may be specified to control the
appearance of the plot.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a handle to the "stem series"
hggroup containing the line and marker objects used for the plot.
Note: stem, for a description of the "stem series"
object.
Example:
theta = 0:0.2:6;
stem3 (cos (theta), sin (theta), theta);
plots 31 stems with heights from 0 to 6 lying on a circle.
Implementation Note: Color definitions with RGB-triples are not
valid.
See also: Note: stem, Note: bar, *note hist:
XREFhist, Note: plot.
-- : scatter (X, Y)
-- : scatter (X, Y, S)
-- : scatter (X, Y, S, C)
-- : scatter (..., STYLE)
-- : scatter (..., "filled")
-- : scatter (..., PROP, VAL, ...)
-- : scatter (HAX, ...)
-- : H = scatter (...)
Draw a 2-D scatter plot.
A marker is plotted at each point defined by the coordinates in the
vectors X and Y.
The size of the markers is determined by S, which can be a scalar
or a vector of the same length as X and Y. If S is not given, or
is an empty matrix, then a default value of 36 square points is
used (The marker size itself is ‘sqrt (s)’).
The color of the markers is determined by C, which can be a string
defining a fixed color; a 3-element vector giving the red, green,
and blue components of the color; a vector of the same length as X
that gives a scaled index into the current colormap; or an Nx3
matrix defining the RGB color of each marker individually.
The marker to use can be changed with the STYLE argument; it is a
string defining a marker in the same manner as the ‘plot’ command.
If no marker is specified it defaults to "o" or circles. If the
argument "filled" is given then the markers are filled.
Additional property/value pairs are passed directly to the
underlying patch object.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a graphics handle to the created
scatter object.
Example:
x = randn (100, 1);
y = randn (100, 1);
scatter (x, y, [], sqrt (x.^2 + y.^2));
See also: Note: scatter3, Note: patch,
Note: plot.
-- : plotmatrix (X, Y)
-- : plotmatrix (X)
-- : plotmatrix (..., STYLE)
-- : plotmatrix (HAX, ...)
-- : [H, AX, BIGAX, P, PAX] = plotmatrix (...)
Scatter plot of the columns of one matrix against another.
Given the arguments X and Y that have a matching number of rows,
‘plotmatrix’ plots a set of axes corresponding to
plot (X(:, i), Y(:, j))
When called with a single argument X this is equivalent to
plotmatrix (X, X)
except that the diagonal of the set of axes will be replaced with
the histogram ‘hist (X(:, i))’.
The marker to use can be changed with the STYLE argument, that is a
string defining a marker in the same manner as the ‘plot’ command.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H provides handles to the individual
graphics objects in the scatter plots, whereas AX returns the
handles to the scatter plot axes objects.
BIGAX is a hidden axes object that surrounds the other axes, such
that the commands ‘xlabel’, ‘title’, etc., will be associated with
this hidden axes.
Finally, P returns the graphics objects associated with the
histogram and PAX the corresponding axes objects.
Example:
plotmatrix (randn (100, 3), "g+")
See also: Note: scatter, Note: plot.
-- : pareto (Y)
-- : pareto (Y, X)
-- : pareto (HAX, ...)
-- : H = pareto (...)
Draw a Pareto chart.
A Pareto chart is a bar graph that arranges information in such a
way that priorities for process improvement can be established; It
organizes and displays information to show the relative importance
of data. The chart is similar to the histogram or bar chart,
except that the bars are arranged in decreasing magnitude from left
to right along the x-axis.
The fundamental idea (Pareto principle) behind the use of Pareto
diagrams is that the majority of an effect is due to a small subset
of the causes. For quality improvement, the first few contributing
causes (leftmost bars as presented on the diagram) to a problem
usually account for the majority of the result. Thus, targeting
these "major causes" for elimination results in the most
cost-effective improvement scheme.
Typically only the magnitude data Y is present in which case X is
taken to be the range ‘1 : length (Y)’. If X is given it may be a
string array, a cell array of strings, or a numerical vector.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a 2-element vector with a graphics
handle for the created bar plot and a second handle for the created
line plot.
An example of the use of ‘pareto’ is
Cheese = {"Cheddar", "Swiss", "Camembert", ...
"Munster", "Stilton", "Blue"};
Sold = [105, 30, 70, 10, 15, 20];
pareto (Sold, Cheese);
See also: Note: bar, Note: barh, *note hist:
XREFhist, Note: pie, Note: plot.
-- : rose (TH)
-- : rose (TH, NBINS)
-- : rose (TH, BINS)
-- : rose (HAX, ...)
-- : H = rose (...)
-- : [THOUT ROUT] = rose (...)
Plot an angular histogram.
With one vector argument, TH, plot the histogram with 20 angular
bins. If TH is a matrix then each column of TH produces a separate
histogram.
If NBINS is given and is a scalar, then the histogram is produced
with NBIN bins. If BINS is a vector, then the center of each bin
is defined by the values in BINS and the number of bins is given by
the number of elements in BINS.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a vector of graphics handles to the
line objects representing each histogram.
If two output arguments are requested then no plot is made and the
polar vectors necessary to plot the histogram are returned instead.
Example
[th, r] = rose ([2*randn(1e5,1), pi + 2*randn(1e5,1)]);
polar (th, r);
Programming Note: When specifying bin centers with the BINS input,
the edges for bins 2 to N-1 are spaced so that ‘BINS(i)’ is
centered between the edges. The final edge is drawn halfway
between bin N and bin 1. This guarantees that all input TH will be
placed into one of the bins, but also means that for some
combinations bin 1 and bin N may not be centered on the user’s
given values.
See also: Note: hist, Note: polar.
The ‘contour’, ‘contourf’ and ‘contourc’ functions produce
two-dimensional contour plots from three-dimensional data.
-- : contour (Z)
-- : contour (Z, VN)
-- : contour (X, Y, Z)
-- : contour (X, Y, Z, VN)
-- : contour (..., STYLE)
-- : contour (HAX, ...)
-- : [C, H] = contour (...)
Create a 2-D contour plot.
Plot level curves (contour lines) of the matrix Z, using the
contour matrix C computed by ‘contourc’ from the same arguments;
see the latter for their interpretation.
The appearance of contour lines can be defined with a line style
STYLE in the same manner as ‘plot’. Only line style and color are
used; Any markers defined by STYLE are ignored.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional output C contains the contour levels in ‘contourc’
format.
The optional return value H is a graphics handle to the hggroup
comprising the contour lines.
Example:
x = 0:2;
y = x;
z = x' * y;
contour (x, y, z, 2:3)
See also: Note: ezcontour, *note contourc:
XREFcontourc, Note: contourf, *note contour3:
XREFcontour3, Note: clabel, Note: meshc,
Note: surfc, Note: caxis, *note colormap:
XREFcolormap, Note: plot.
-- : contourf (Z)
-- : contourf (Z, VN)
-- : contourf (X, Y, Z)
-- : contourf (X, Y, Z, VN)
-- : contourf (..., STYLE)
-- : contourf (HAX, ...)
-- : [C, H] = contourf (...)
Create a 2-D contour plot with filled intervals.
Plot level curves (contour lines) of the matrix Z and fill the
region between lines with colors from the current colormap.
The level curves are taken from the contour matrix C computed by
‘contourc’ for the same arguments; see the latter for their
interpretation.
The appearance of contour lines can be defined with a line style
STYLE in the same manner as ‘plot’. Only line style and color are
used; Any markers defined by STYLE are ignored.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional output C contains the contour levels in ‘contourc’
format.
The optional return value H is a graphics handle to the hggroup
comprising the contour lines.
The following example plots filled contours of the ‘peaks’
function.
[x, y, z] = peaks (50);
contourf (x, y, z, -7:9)
See also: Note: ezcontourf, *note contour:
XREFcontour, Note: contourc, *note contour3:
XREFcontour3, Note: clabel, Note: meshc,
Note: surfc, Note: caxis, *note colormap:
XREFcolormap, Note: plot.
-- : [C, LEV] = contourc (Z)
-- : [C, LEV] = contourc (Z, VN)
-- : [C, LEV] = contourc (X, Y, Z)
-- : [C, LEV] = contourc (X, Y, Z, VN)
Compute contour lines (isolines of constant Z value).
The matrix Z contains height values above the rectangular grid
determined by X and Y. If only a single input Z is provided then X
is taken to be ‘1:columns (Z)’ and Y is taken to be ‘1:rows (Z)’.
The optional input VN is either a scalar denoting the number of
contour lines to compute or a vector containing the Z values where
lines will be computed. When VN is a vector the number of contour
lines is ‘numel (VN)’. However, to compute a single contour line
at a given value use ‘VN = [val, val]’. If VN is omitted it
defaults to 10.
The return value C is a 2xN matrix containing the contour lines in
the following format
C = [lev1, x1, x2, ..., levn, x1, x2, ...
len1, y1, y2, ..., lenn, y1, y2, ...]
in which contour line N has a level (height) of LEVN and length of
LENN.
The optional return value LEV is a vector with the Z values of the
contour levels.
Example:
x = 0:2;
y = x;
z = x' * y;
contourc (x, y, z, 2:3)
⇒ 2.0000 2.0000 1.0000 3.0000 1.5000 2.0000
2.0000 1.0000 2.0000 2.0000 2.0000 1.5000
See also: Note: contour, Note: contourf,
Note: contour3, Note: clabel.
-- : contour3 (Z)
-- : contour3 (Z, VN)
-- : contour3 (X, Y, Z)
-- : contour3 (X, Y, Z, VN)
-- : contour3 (..., STYLE)
-- : contour3 (HAX, ...)
-- : [C, H] = contour3 (...)
Create a 3-D contour plot.
‘contour3’ plots level curves (contour lines) of the matrix Z at a
Z level corresponding to each contour. This is in contrast to
‘contour’ which plots all of the contour lines at the same Z level
and produces a 2-D plot.
The level curves are taken from the contour matrix C computed by
‘contourc’ for the same arguments; see the latter for their
interpretation.
The appearance of contour lines can be defined with a line style
STYLE in the same manner as ‘plot’. Only line style and color are
used; Any markers defined by STYLE are ignored.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional output C are the contour levels in ‘contourc’ format.
The optional return value H is a graphics handle to the hggroup
comprising the contour lines.
Example:
contour3 (peaks (19));
colormap cool;
hold on;
surf (peaks (19), "facecolor", "none", "edgecolor", "black");
See also: Note: contour, Note: contourc,
Note: contourf, Note: clabel, Note:
meshc, Note: surfc, Note: caxis,
Note: colormap, Note: plot.
The ‘errorbar’, ‘semilogxerr’, ‘semilogyerr’, and ‘loglogerr’
functions produce plots with error bar markers. For example,
rand ("state", 2);
x = 0:0.1:10;
y = sin (x);
lerr = 0.1 .* rand (size (x));
uerr = 0.1 .* rand (size (x));
errorbar (x, y, lerr, uerr);
axis ([0, 10, -1.1, 1.1]);
xlabel ("x");
ylabel ("sin (x)");
title ("Errorbar plot of sin (x)");
produces the figure shown in Note: Figure 15.3.
[image src="errorbar.png" text="
+---------------------------------+
| Image unavailable in text mode. |
+---------------------------------+" ]
Figure 15.3: Errorbar plot.
-- : errorbar (Y, EY)
-- : errorbar (Y, ..., FMT)
-- : errorbar (X, Y, EY)
-- : errorbar (X, Y, ERR, FMT)
-- : errorbar (X, Y, LERR, UERR, FMT)
-- : errorbar (X, Y, EX, EY, FMT)
-- : errorbar (X, Y, LX, UX, LY, UY, FMT)
-- : errorbar (X1, Y1, ..., FMT, XN, YN, ...)
-- : errorbar (HAX, ...)
-- : H = errorbar (...)
Create a 2-D plot with errorbars.
Many different combinations of arguments are possible. The
simplest form is
errorbar (Y, EY)
where the first argument is taken as the set of Y coordinates, the
second argument EY are the errors around the Y values, and the X
coordinates are taken to be the indices of the elements (‘1:numel
(Y)’).
The general form of the function is
errorbar (X, Y, ERR1, ..., FMT, ...)
After the X and Y arguments there can be 1, 2, or 4 parameters
specifying the error values depending on the nature of the error
values and the plot format FMT.
ERR (scalar)
When the error is a scalar all points share the same error
value. The errorbars are symmetric and are drawn from
DATA-ERR to DATA+ERR. The FMT argument determines whether ERR
is in the x-direction, y-direction (default), or both.
ERR (vector or matrix)
Each data point has a particular error value. The errorbars
are symmetric and are drawn from DATA(n)-ERR(n) to
DATA(n)+ERR(n).
LERR, UERR (scalar)
The errors have a single low-side value and a single
upper-side value. The errorbars are not symmetric and are
drawn from DATA-LERR to DATA+UERR.
LERR, UERR (vector or matrix)
Each data point has a low-side error and an upper-side error.
The errorbars are not symmetric and are drawn from
DATA(n)-LERR(n) to DATA(n)+UERR(n).
Any number of data sets (X1,Y1, X2,Y2, ...) may appear as long as
they are separated by a format string FMT.
If Y is a matrix, X and the error parameters must also be matrices
having the same dimensions. The columns of Y are plotted versus
the corresponding columns of X and errorbars are taken from the
corresponding columns of the error parameters.
If FMT is missing, the yerrorbars ("~") plot style is assumed.
If the FMT argument is supplied then it is interpreted, as in
normal plots, to specify the line style, marker, and color. In
addition, FMT may include an errorbar style which *must precede*
the ordinary format codes. The following errorbar styles are
supported:
‘~’
Set yerrorbars plot style (default).
‘>’
Set xerrorbars plot style.
‘~>’
Set xyerrorbars plot style.
‘#~’
Set yboxes plot style.
‘#’
Set xboxes plot style.
‘#~>’
Set xyboxes plot style.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a handle to the hggroup object
representing the data plot and errorbars.
Note: For compatibility with MATLAB a line is drawn through all
data points. However, most scientific errorbar plots are a scatter
plot of points with errorbars. To accomplish this, add a marker
style to the FMT argument such as ".". Alternatively, remove the
line by modifying the returned graphic handle with ‘set (h,
"linestyle", "none")’.
Examples:
errorbar (X, Y, EX, ">.r")
produces an xerrorbar plot of Y versus X with X errorbars drawn
from X-EX to X+EX. The marker "." is used so no connecting line
is drawn and the errorbars appear in red.
errorbar (X, Y1, EY, "~",
X, Y2, LY, UY)
produces yerrorbar plots with Y1 and Y2 versus X. Errorbars for Y1
are drawn from Y1-EY to Y1+EY, errorbars for Y2 from Y2-LY to
Y2+UY.
errorbar (X, Y, LX, UX,
LY, UY, "~>")
produces an xyerrorbar plot of Y versus X in which X errorbars are
drawn from X-LX to X+UX and Y errorbars from Y-LY to Y+UY.
See also: Note: semilogxerr, *note semilogyerr:
XREFsemilogyerr, Note: loglogerr, *note plot:
XREFplot.
-- : semilogxerr (Y, EY)
-- : semilogxerr (Y, ..., FMT)
-- : semilogxerr (X, Y, EY)
-- : semilogxerr (X, Y, ERR, FMT)
-- : semilogxerr (X, Y, LERR, UERR, FMT)
-- : semilogxerr (X, Y, EX, EY, FMT)
-- : semilogxerr (X, Y, LX, UX, LY, UY, FMT)
-- : semilogxerr (X1, Y1, ..., FMT, XN, YN, ...)
-- : semilogxerr (HAX, ...)
-- : H = semilogxerr (...)
Produce 2-D plots using a logarithmic scale for the x-axis and
errorbars at each data point.
Many different combinations of arguments are possible. The most
common form is
semilogxerr (X, Y, EY, FMT)
which produces a semi-logarithmic plot of Y versus X with errors in
the Y-scale defined by EY and the plot format defined by FMT.
Note: errorbar, for available formats and additional
information.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
See also: Note: errorbar, *note semilogyerr:
XREFsemilogyerr, Note: loglogerr.
-- : semilogyerr (Y, EY)
-- : semilogyerr (Y, ..., FMT)
-- : semilogyerr (X, Y, EY)
-- : semilogyerr (X, Y, ERR, FMT)
-- : semilogyerr (X, Y, LERR, UERR, FMT)
-- : semilogyerr (X, Y, EX, EY, FMT)
-- : semilogyerr (X, Y, LX, UX, LY, UY, FMT)
-- : semilogyerr (X1, Y1, ..., FMT, XN, YN, ...)
-- : semilogyerr (HAX, ...)
-- : H = semilogyerr (...)
Produce 2-D plots using a logarithmic scale for the y-axis and
errorbars at each data point.
Many different combinations of arguments are possible. The most
common form is
semilogyerr (X, Y, EY, FMT)
which produces a semi-logarithmic plot of Y versus X with errors in
the Y-scale defined by EY and the plot format defined by FMT.
Note: errorbar, for available formats and additional
information.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
See also: Note: errorbar, *note semilogxerr:
XREFsemilogxerr, Note: loglogerr.
-- : loglogerr (Y, EY)
-- : loglogerr (Y, ..., FMT)
-- : loglogerr (X, Y, EY)
-- : loglogerr (X, Y, ERR, FMT)
-- : loglogerr (X, Y, LERR, UERR, FMT)
-- : loglogerr (X, Y, EX, EY, FMT)
-- : loglogerr (X, Y, LX, UX, LY, UY, FMT)
-- : loglogerr (X1, Y1, ..., FMT, XN, YN, ...)
-- : loglogerr (HAX, ...)
-- : H = loglogerr (...)
Produce 2-D plots on a double logarithm axis with errorbars.
Many different combinations of arguments are possible. The most
common form is
loglogerr (X, Y, EY, FMT)
which produces a double logarithm plot of Y versus X with errors in
the Y-scale defined by EY and the plot format defined by FMT.
Note: errorbar, for available formats and additional
information.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
See also: Note: errorbar, *note semilogxerr:
XREFsemilogxerr, Note: semilogyerr.
Finally, the ‘polar’ function allows you to easily plot data in polar
coordinates. However, the display coordinates remain rectangular and
linear. For example,
polar (0:0.1:10*pi, 0:0.1:10*pi);
title ("Example polar plot from 0 to 10*pi");
produces the spiral plot shown in Note: Figure 15.4.
[image src="polar.png" text="
+---------------------------------+
| Image unavailable in text mode. |
+---------------------------------+" ]
Figure 15.4: Polar plot.
-- : polar (THETA, RHO)
-- : polar (THETA, RHO, FMT)
-- : polar (CPLX)
-- : polar (CPLX, FMT)
-- : polar (HAX, ...)
-- : H = polar (...)
Create a 2-D plot from polar coordinates THETA and RHO.
If a single complex input CPLX is given then the real part is used
for THETA and the imaginary part is used for RHO.
The optional argument FMT specifies the line format in the same way
as ‘plot’.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a graphics handle to the created
plot.
Implementation Note: The polar axis is drawn using line and text
objects encapsulated in an hggroup. The hggroup properties are
linked to the original axes object such that altering an appearance
property, for example ‘fontname’, will update the polar axis. Two
new properties are added to the original axes–‘rtick’,
‘ttick’–which replace ‘xtick’, ‘ytick’. The first is a list of
tick locations in the radial (rho) direction; The second is a list
of tick locations in the angular (theta) direction specified in
degrees, i.e., in the range 0–359.
See also: Note: rose, Note: compass, Note:
plot.
-- : pie (X)
-- : pie (..., EXPLODE)
-- : pie (..., LABELS)
-- : pie (HAX, ...);
-- : H = pie (...);
Plot a 2-D pie chart.
When called with a single vector argument, produce a pie chart of
the elements in X. The size of the ith slice is the percentage
that the element Xi represents of the total sum of X: ‘pct = X(i) /
sum (X)’.
The optional input EXPLODE is a vector of the same length as X
that, if nonzero, "explodes" the slice from the pie chart.
The optional input LABELS is a cell array of strings of the same
length as X specifying the label for each slice.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a list of handles to the patch and
text objects generating the plot.
Note: If ‘sum (X) ≤ 1’ then the elements of X are interpreted as
percentages directly and are not normalized by ‘sum (x)’.
Furthermore, if the sum is less than 1 then there will be a missing
slice in the pie plot to represent the missing, unspecified
percentage.
See also: Note: pie3, Note: bar, *note hist:
XREFhist, Note: rose.
-- : pie3 (X)
-- : pie3 (..., EXPLODE)
-- : pie3 (..., LABELS)
-- : pie3 (HAX, ...);
-- : H = pie3 (...);
Plot a 3-D pie chart.
Called with a single vector argument, produces a 3-D pie chart of
the elements in X. The size of the ith slice is the percentage
that the element Xi represents of the total sum of X: ‘pct = X(i) /
sum (X)’.
The optional input EXPLODE is a vector of the same length as X
that, if nonzero, "explodes" the slice from the pie chart.
The optional input LABELS is a cell array of strings of the same
length as X specifying the label for each slice.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a list of graphics handles to the
patch, surface, and text objects generating the plot.
Note: If ‘sum (X) ≤ 1’ then the elements of X are interpreted as
percentages directly and are not normalized by ‘sum (x)’.
Furthermore, if the sum is less than 1 then there will be a missing
slice in the pie plot to represent the missing, unspecified
percentage.
See also: Note: pie, Note: bar, *note hist:
XREFhist, Note: rose.
-- : quiver (U, V)
-- : quiver (X, Y, U, V)
-- : quiver (..., S)
-- : quiver (..., STYLE)
-- : quiver (..., "filled")
-- : quiver (HAX, ...)
-- : H = quiver (...)
Plot a 2-D vector field with arrows.
Plot the (U, V) components of a vector field at the grid points
defined by (X, Y). If the grid is uniform then X and Y can be
specified as vectors and ‘meshgrid’ is used to create the 2-D grid.
If X and Y are not given they are assumed to be ‘(1:M, 1:N)’ where
‘[M, N] = size (U)’.
The optional input S is a scalar defining a scaling factor to use
for the arrows of the field relative to the mesh spacing. A value
of 1.0 will result in the longest vector exactly filling one grid
square. A value of 0 disables all scaling. The default value is
0.9.
The style to use for the plot can be defined with a line style
STYLE of the same format as the ‘plot’ command. If a marker is
specified then the markers are drawn at the origin of the vectors
(which are the grid points defined by X and Y). When a marker is
specified, the arrowhead is not drawn. If the argument "filled" is
given then the markers are filled.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a graphics handle to a quiver
object. A quiver object regroups the components of the quiver plot
(body, arrow, and marker), and allows them to be changed together.
Example:
[x, y] = meshgrid (1:2:20);
h = quiver (x, y, sin (2*pi*x/10), sin (2*pi*y/10));
set (h, "maxheadsize", 0.33);
See also: Note: quiver3, Note: compass,
Note: feather, Note: plot.
-- : quiver3 (U, V, W)
-- : quiver3 (X, Y, Z, U, V, W)
-- : quiver3 (..., S)
-- : quiver3 (..., STYLE)
-- : quiver3 (..., "filled")
-- : quiver3 (HAX, ...)
-- : H = quiver3 (...)
Plot a 3-D vector field with arrows.
Plot the (U, V, W) components of a vector field at the grid points
defined by (X, Y, Z). If the grid is uniform then X, Y, and Z can
be specified as vectors and ‘meshgrid’ is used to create the 3-D
grid.
If X, Y, and Z are not given they are assumed to be ‘(1:M, 1:N,
1:P)’ where ‘[M, N] = size (U)’ and ‘P = max (size (W))’.
The optional input S is a scalar defining a scaling factor to use
for the arrows of the field relative to the mesh spacing. A value
of 1.0 will result in the longest vector exactly filling one grid
cube. A value of 0 disables all scaling. The default value is
0.9.
The style to use for the plot can be defined with a line style
STYLE of the same format as the ‘plot’ command. If a marker is
specified then the markers are drawn at the origin of the vectors
(which are the grid points defined by X, Y, Z). When a marker is
specified, the arrowhead is not drawn. If the argument "filled" is
given then the markers are filled.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a graphics handle to a quiver
object. A quiver object regroups the components of the quiver plot
(body, arrow, and marker), and allows them to be changed together.
[x, y, z] = peaks (25);
surf (x, y, z);
hold on;
[u, v, w] = surfnorm (x, y, z / 10);
h = quiver3 (x, y, z, u, v, w);
set (h, "maxheadsize", 0.33);
See also: Note: quiver, Note: compass,
Note: feather, Note: plot.
-- : compass (U, V)
-- : compass (Z)
-- : compass (..., STYLE)
-- : compass (HAX, ...)
-- : H = compass (...)
Plot the ‘(U, V)’ components of a vector field emanating from the
origin of a polar plot.
The arrow representing each vector has one end at the origin and
the tip at [U(i), V(i)]. If a single complex argument Z is given,
then ‘U = real (Z)’ and ‘V = imag (Z)’.
The style to use for the plot can be defined with a line style
STYLE of the same format as the ‘plot’ command.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a vector of graphics handles to the
line objects representing the drawn vectors.
a = toeplitz ([1;randn(9,1)], [1,randn(1,9)]);
compass (eig (a));
See also: Note: polar, Note: feather, Note:
quiver, Note: rose, Note: plot.
-- : feather (U, V)
-- : feather (Z)
-- : feather (..., STYLE)
-- : feather (HAX, ...)
-- : H = feather (...)
Plot the ‘(U, V)’ components of a vector field emanating from
equidistant points on the x-axis.
If a single complex argument Z is given, then ‘U = real (Z)’ and ‘V
= imag (Z)’.
The style to use for the plot can be defined with a line style
STYLE of the same format as the ‘plot’ command.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a vector of graphics handles to the
line objects representing the drawn vectors.
phi = [0 : 15 : 360] * pi/180;
feather (sin (phi), cos (phi));
See also: Note: plot, Note: quiver, Note:
compass.
-- : pcolor (X, Y, C)
-- : pcolor (C)
-- : pcolor (HAX, ...)
-- : H = pcolor (...)
Produce a 2-D density plot.
A ‘pcolor’ plot draws rectangles with colors from the matrix C over
the two-dimensional region represented by the matrices X and Y. X
and Y are the coordinates of the mesh’s vertices and are typically
the output of ‘meshgrid’. If X and Y are vectors, then a typical
vertex is (X(j), Y(i), C(i,j)). Thus, columns of C correspond to
different X values and rows of C correspond to different Y values.
The values in C are scaled to span the range of the current
colormap. Limits may be placed on the color axis by the command
‘caxis’, or by setting the ‘clim’ property of the parent axis.
The face color of each cell of the mesh is determined by
interpolating the values of C for each of the cell’s vertices;
Contrast this with ‘imagesc’ which renders one cell for each
element of C.
‘shading’ modifies an attribute determining the manner by which the
face color of each cell is interpolated from the values of C, and
the visibility of the cells’ edges. By default the attribute is
"faceted", which renders a single color for each cell’s face with
the edge visible.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a graphics handle to the created
surface object.
See also: Note: caxis, Note: shading, Note:
meshgrid, Note: contour, *note imagesc:
XREFimagesc.
-- : area (Y)
-- : area (X, Y)
-- : area (..., LVL)
-- : area (..., PROP, VAL, ...)
-- : area (HAX, ...)
-- : H = area (...)
Area plot of the columns of Y.
This plot shows the contributions of each column value to the row
sum. It is functionally similar to ‘plot (X, cumsum (Y, 2))’,
except that the area under the curve is shaded.
If the X argument is omitted it defaults to ‘1:rows (Y)’. A value
LVL can be defined that determines where the base level of the
shading under the curve should be defined. The default level is 0.
Additional property/value pairs are passed directly to the
underlying patch object.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a graphics handle to the hggroup
object comprising the area patch objects. The "BaseValue" property
of the hggroup can be used to adjust the level where shading
begins.
Example: Verify identity sin^2 + cos^2 = 1
t = linspace (0, 2*pi, 100)';
y = [sin(t).^2, cos(t).^2];
area (t, y);
legend ("sin^2", "cos^2", "location", "NorthEastOutside");
See also: Note: plot, Note: patch.
-- : fill (X, Y, C)
-- : fill (X1, Y1, C1, X2, Y2, C2)
-- : fill (..., PROP, VAL)
-- : fill (HAX, ...)
-- : H = fill (...)
Create one or more filled 2-D polygons.
The inputs X and Y are the coordinates of the polygon vertices. If
the inputs are matrices then the rows represent different vertices
and each column produces a different polygon. ‘fill’ will close
any open polygons before plotting.
The input C determines the color of the polygon. The simplest form
is a single color specification such as a ‘plot’ format or an
RGB-triple. In this case the polygon(s) will have one unique
color. If C is a vector or matrix then the color data is first
scaled using ‘caxis’ and then indexed into the current colormap. A
row vector will color each polygon (a column from matrices X and Y)
with a single computed color. A matrix C of the same size as X and
Y will compute the color of each vertex and then interpolate the
face color between the vertices.
Multiple property/value pairs for the underlying patch object may
be specified, but they must appear in pairs.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
The optional return value H is a vector of graphics handles to the
created patch objects.
Example: red square
vertices = [0 0
1 0
1 1
0 1];
fill (vertices(:,1), vertices(:,2), "r");
axis ([-0.5 1.5, -0.5 1.5])
axis equal
See also: Note: patch, Note: caxis, Note:
colormap.
-- : comet (Y)
-- : comet (X, Y)
-- : comet (X, Y, P)
-- : comet (HAX, ...)
Produce a simple comet style animation along the trajectory
provided by the input coordinate vectors (X, Y).
If X is not specified it defaults to the indices of Y.
The speed of the comet may be controlled by P, which represents the
time each point is displayed before moving to the next one. The
default for P is 0.1 seconds.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
See also: Note: comet3.
-- : comet3 (Z)
-- : comet3 (X, Y, Z)
-- : comet3 (X, Y, Z, P)
-- : comet3 (HAX, ...)
Produce a simple comet style animation along the trajectory
provided by the input coordinate vectors (X, Y, Z).
If only Z is specified then X, Y default to the indices of Z.
The speed of the comet may be controlled by P, which represents the
time each point is displayed before moving to the next one. The
default for P is 0.1 seconds.
If the first argument HAX is an axes handle, then plot into this
axes, rather than the current axes returned by ‘gca’.
See also: Note: comet.
automatically generated by info2www version 1.2.2.9