MATLAB's plot drawing

plot: 2-D line plot

Syntax

  1. plot(X,Y)
  2. plot(X,Y,LineSpec)
  3. plot(X1,Y1,…,Xn,Yn)
  4. plot(X1,Y1,LineSpec1,…,Xn,Yn,LineSpecn)
  5. plot(Y)
  6. plot(Y,LineSpec)
  7. plot(tbl,xvar,yvar)
  8. plot(tbl,yvar)
  9. plot(ax,___)
  10. plot(___,Name,Value)
  11. p = plot(___)

Description

plot(X,Y)

plot(X,Y) creates a 2-D line plot of the data in Y versus the corresponding values in X.

  1. To plot a set of coordinates connected by line segments, specify X and Y as vectors of the same length. (To plot a set of coordinates connected by line segments, specify X and Y as vectors of the same length.)
  2. To plot multiple sets of coordinates on the same set of axes, specify at least one of X or Y as a matrix. (To plot multiple sets of coordinates on the same set of axes, specify at least one of X or Y as a matrix .)

plot(X,Y,LineSpec)

plot(X,Y,LineSpec) creates the plot using the specified line style, marker, and color.

plot(X1,Y1,…,Xn,Yn)

plot(X1,Y1,…,Xn,Yn) plots multiple pairs of x- and y-coordinates on the same set of axes. Use this syntax as an alternative to specifying coordinates as matrices. Matrix alternative.)

plot(X1,Y1,LineSpec1,…,Xn,Yn,LineSpecn)

plot(X1,Y1,LineSpec1,…,Xn,Yn,LineSpecn) assigns specific line styles, markers, and colors to each x-y pair. You can specify LineSpec for some x-y pairs and omit it for others. For example, plot(X1,Y1,“o”,X2,Y2) specifies markers for the first x-y pair but not for the second pair.

plot(Y)

plot(Y) plots Y against an implicit set of x-coordinates. (plot(Y) plots Y against an implicit set of x-coordinates.)

  1. If Y is a vector, the x-coordinates range from 1 to length(Y).
  2. If Y is a matrix, the plot contains one line for each column in Y. The x-coordinates range from 1 to the number of rows in Y. (If Y is a matrix, then each column of Y will draw a line, The x coordinate increments from 1 to the number of rows in Y.)

If Y contains complex numbers, MATLAB® plots the imaginary part of Y versus the real part of Y. If you specify both X and Y, the imaginary part is ignored. (If Y contains complex numbers, MATLAB® plots the imaginary part of Y versus the real part of Y. The real part of . If both X and Y are specified, the imaginary part is ignored.)

plot(Y,LineSpec)

plot(Y,LineSpec) plots Y using implicit x-coordinates, and specifies the line style, marker, and color.

plot(tbl,xvar,yvar)

plot(tbl,xvar,yvar)plots the variables xvar and yvar from the table tbl. To plot one data set, specify one variable for xvar and one variable for yvar. To plot multiple data sets, specify multiple variables for xvar, yvar, or both. If both arguments specify multiple variables, they must specify the same number of variables. (since R2022a) ( Plot (tbl,xvar,yvar)Plot variables xvar and yvar in table tbl. To plot one data set, specify a variable for xvar and yvar respectively. To plot multiple data sets, Please specify multiple variables for xvar, yvar, or both. If both arguments specify multiple variables, they must specify the same number of variables. (Since R2022a))

plot(tbl,yvar)

plot(tbl,yvar)plots the specified variable from the table against the row indices of the table. If the table is a timetable, the specified variable is plotted against the row times of the timetable. (since R2022a Plot (tbl,yvar)) Variable. If the table is a timetable, the specified variable is plotted against the row times of the timetable. (Since R2022a))

plot(ax,___)

plot(ax,___)Plot (ax,___)displays the plot in the target axes. Specify the axes as the first argument in any of the previous syntaxes.

plot(___,Name,Value)

plot(___,Name,Value)specifies Line properties using one or more name-value arguments. The properties apply to all the plotted lines. Specify the name-value arguments after all the arguments in any of the previous syntaxes. For a list of properties, see Line Properties. ( plot(___,Name,Value)Using One or more name-value arguments specify line attributes. These attributes apply to all drawn lines. Name-value arguments are specified after all arguments. See Line Attributes for a list of attributes.)

p = plot(___)

p = plot(___)returns a Line object or an array of Line objects. Use p to modify properties of the plot after creating it. For a list of properties, see Line Properties. ( p = plot(___)returns a Line object or an array of Line objects. Use p to modify properties of the plot after creating it. Modify its properties.)

Vector and Matrix Data Table Data Additional Options
plot(X,Y) plot(tbl,xvar,yvar) plot(ax,___)
plot(X,Y,LineSpec) plot(tbl,yvar) plot(___,Name,Value)
plot(X1,Y1,…,Xn,Yn) p = plot(___)
plot(X1,Y1,LineSpec1,…,Xn,Yn,LineSpecn)
plot(Y)
plot(Y,LineSpec)

Guess you like

Origin blog.csdn.net/chengkai730/article/details/132712638