Main Content

plot (DataMatrix)

Draw 2-D line plot of DataMatrix object

Syntax

plot(DMObj1)
plot(DMObj1, DMObj2)
plot(..., LineSpec)

Arguments

DMObj1, DMObj2

DataMatrix objects, such as created by DataMatrix (object constructor).

Note

If both DMObj1 and DMObj2 are input arguments, one of the inputs can be a MATLAB® numeric array.

LineSpec

Character vector specifying a line style, marker symbol, and color of the plotted lines. For more information on these specifiers, see Line Specifications.

Description

plot(DMObj1) plots the columns of a DataMatrix object DMObj1 versus their index.

plot(DMObj1, DMObj2) plots the data from DMObj1 and DMObj2, two DataMatrix objects, or one DataMatrix object and one MATLAB numeric array.

  • If DMObj1 and DMObj2 are both vectors, they must have the same number of elements, and plot plots one vector versus the other vector, creating a single line.

  • If one is a vector and one a scalar, plot plots discrete points vertically or horizontally, at the scalar value.

  • If one is a vector and one a matrix, the number of elements in the vector must equal either the number of rows or the number of columns in the matrix, and plot plots the vector versus each row or column in the matrix.

  • If both are matrices, they must have the same size (number of rows and columns), and plot plots each column in DMObj1 versus the corresponding column in DMObj2.

plot(..., LineSpec) plots all lines as defined by LineSpec, a character vector specifying a line style, marker symbol, and/or color.

More About

collapse all

Line Specifications

The following tables list available line styles, markers, and colors.

Line StyleDescriptionResulting Line
'-'Solid line

Sample of solid line

'--'Dashed line

Sample of dashed line

':'Dotted line

Sample of dotted line

'-.'Dash-dotted line

Sample of dash-dotted line, with alternating dashes and dots

MarkerDescriptionResulting Marker
'o'Circle

Sample of circle marker

'+'Plus sign

Sample of plus sign marker

'*'Asterisk

Sample of asterisk marker

'.'Point

Sample of point marker

'x'Cross

Sample of cross marker

'_'Horizontal line

Sample of horizontal line marker

'|'Vertical line

Sample of vertical line marker

's'Square

Sample of square marker

'd'Diamond

Sample of diamond line marker

'^'Upward-pointing triangle

Sample of upward-pointing triangle marker

'v'Downward-pointing triangle

Sample of downward-pointing triangle marker

'>'Right-pointing triangle

Sample of right-pointing triangle marker

'<'Left-pointing triangle

Sample of left-pointing triangle marker

'p'Pentagram

Sample of pentagram marker

'h'Hexagram

Sample of hexagram marker

Color NameShort NameRGB TripletAppearance
'red''r'[1 0 0]

Sample of the color red

'green''g'[0 1 0]

Sample of the color green

'blue''b'[0 0 1]

Sample of the color blue

'cyan' 'c'[0 1 1]

Sample of the color cyan

'magenta''m'[1 0 1]

Sample of the color magenta

'yellow''y'[1 1 0]

Sample of the color yellow

'black''k'[0 0 0]

Sample of the color black

'white''w'[1 1 1]

Sample of the color white

Introduced in R2008b