matlab Two-dimensional curve drawing common methods, to keep the use of
Grammar
Plot (Y)
Plot (X1,y1,...)
Plot (X1,y1,linespec,...)
Plot (..., ' PropertyName ', PropertyValue,...)
Plot (Axes_handle,...)
h = Plot (...)
Hlines = Plot (' V6 ',...)
Description
Plot (y) if Y is an array of MXN, 1:m is x-axis, each column element in Y is y-coordinate, and n-curves are plotted, and if y is a vector of nx1 or 1xn, the y is the horizontal axis of the 1:n, and a 1 curve for the coordinate table if y is the plural, and plot (y) is equivalent to plot Real (y), imag (y)), ignoring imaginary parts of coordinate data in other usage cases.
Plot (X1,y1,...) If x and Y are arrays, draw coordinate data by column, they must have the same dimensions, and if x and Y are one of the vectors and the other is an array, the dimensions equal in x and Y are plotted for multiple curves; if x and Y are one of the scalar and the other is a vector, then the vertical x or y-axis discrete points are drawn.
X |
Y |
|
Note |
Mxn |
Mxn |
Draw n curves by column for coordinate data |
X and y must have the same dimensions |
1xn or NX1 |
MXN or NXM |
Auto-match dimensions draw M-curves in the same direction |
Any of four combinations, the same effect |
MXN or NXM |
1xn or NX1 |
Ditto |
Ditto |
1x1 |
1xn or NX1 |
Draw Vertical X-axis discrete points |
Y can be any vector |
1xn or NX1 |
1x1 |
Draw Vertical Y-axis discrete points |
X can be any vector |
Plot (X1,y1,linespec,...) The Curve property of the curve is specified by the parameter Linespec, which includes the Linetype, marker, and color. Plot function supports drawing any group of graphs at the same time
Plot (x1,y1,linespec1,x2,y2,linespec2,...)
This is exactly equivalent to
Plot (X1,Y1,LINESPEC1,...)
Hlod All
Plot (x2,y2,linespec2,...)
The Linetype properties provided in MATLAB are:
Linear |
Description |
Tag character |
Description |
Color |
Description |
- |
Solid Line (default) |
+ |
Plus character |
R |
Red |
-- |
Double Dash |
O |
Hollow Circle |
G |
Green |
: |
Dashed |
* |
Asterisk |
B |
Blue |
:. |
Dot Dash |
. |
Solid Circle |
C |
Cyan Green |
|
|
X |
Fork Symbol |
M |
Magenta |
|
|
S |
Square |
Y |
Yellow |
|
|
D |
Rhombic |
K |
Black |
|
|
^ |
Upper Triangle |
W |
White |
|
|
V |
Lower Triangle |
|
|
|
|
> |
Right triangle |
|