plot
Plots a given dataset in 2D axes.
Syntax
h = plot(y)
h = plot(x, y)
h = plot(x, y, x, y, ...)
h = plot(x, y, fmt)
h = plot(..., property, value, ...)
h = plot(hAxes, ...)
Inputs
- x, y
- Range of the x and y axes.
- fmt
- Formatting string for the curve. It can be any combination of the following strings:
- line style: '-', '-.', ':', '--', '-:'.
- line color: 'r', 'g', 'b', 'c', 'y', 'm', 'w', 'k'.
- marker style: 's', 'o', 'd', 'x', 'v', '^', '+', '*', '.'.
- property
- Properties that control the appearance or behavior of the graphics object.
- value
- Value of the properties.
- hAxes
- Axis handle.
Outputs
- h
- Handle of the line graphics object.
Examples
clf;
plot(rand(1, 10));
clf;
plot(rand(1, 10), 'r:+', 'linewidth', 1);
clf;
x = [0:0.1:2*pi];
plot(x, sin(x), 'g', x, cos(x), 'm');
Comments
h = plot([x,] y [, fmt] [, property, value] ...
plot
takes more arguments to create multiple lines in one axis:
h = plot(x, y, x, y, ...
h = plot([x,] y [, fmt] [, property, value], [x,] y [, fmt] [, property, value] ...
If
the first argument of plot() is an axis handle, lines are created in that
axis:h = plot(hAxes, ...)