2-D Line Plot - MATLAB Plot - MathWorks India
2-D Line Plot - MATLAB Plot - MathWorks India
2-D Line Plot - MATLAB Plot - MathWorks India
X x values
scalar | vector | matrix
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | categorical |
datetime | duration
Line style, marker, and color, specified as a character vector of symbols. The symbols can appear in any order. You
do not need to specify all three characteristics (line style, marker, and color). For example, if you omit the line style
and specify the marker, then the plot shows only the marker and no line.
-- Dashed line
: Dotted line
-. Dash-dot line
Marker Description
o Circle
+ Plus sign
* Asterisk
. Point
x Cross
s Square
d Diamond
^ Upward-pointing triangle
v Downward-pointing triangle
p Pentagram
h Hexagram
Color Description
y yellow
m magenta
c cyan
r red
g green
http://in.mathworks.com/help/matlab/ref/plot.html 15/22
7/8/2017 2-D line plot - MATLAB plot - MathWorks India
Color Description
b blue
w white
k black
Axes in which to plot, specified as an axes object or a polar axes object. If you do not specify the axes and if the
current axes are Cartesian axes, then the plot function uses the current axes. To plot into polar axes, specify the
polar axes object as the first input argument.
Example: 'Marker','o','MarkerFaceColor','red'
The chart line properties listed here are only a subset. For a complete list, see Chart Line Properties. collapse all
Line color, specified as an RGB triplet, a character vector of a color name, or 'none'. If you specify the Color as
'none', then the line is invisible.
An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue
components of the color. The intensities must be in the range [0,1]; for example, [0.4 0.6 0.7]. This table lists
the long and short color name options and the equivalent RGB triplet values.
'yellow' 'y' [1 1 0]
'magenta' 'm' [1 0 1]
'cyan' 'c' [0 1 1]
'red' 'r' [1 0 0]
'green' 'g' [0 1 0]
'blue' 'b' [0 0 1]
'white' 'w' [1 1 1]
'black' 'k' [0 0 0]
Example: 'blue'
Example: [0 0 1]
http://in.mathworks.com/help/matlab/ref/plot.html 16/22
7/8/2017 2-D line plot - MATLAB plot - MathWorks India
Line style, specified as one of the line styles listed in this table.
Line width, specified as a positive value in points. If the line has markers, then the line width also affects the marker
edges.
Example: 0.75
Marker symbol, specified as one of the markers in this table. By default, a chart line does not have markers. Add
markers at each data point along the line by specifying a marker symbol.
Value Description
'o' Circle
'*' Asterisk
'.' Point
'x' Cross
'none' No markers
Example: 'Marker','+'
http://in.mathworks.com/help/matlab/ref/plot.html 17/22
7/8/2017 2-D line plot - MATLAB plot - MathWorks India
Example: 'Marker','diamond'
Indices of data points at which to display markers, specified as a vector of positive integers. If you do not specify the
indices, then MATLAB displays a marker at every data point.
Note: To see the markers, you must also specify a marker symbol.
Example: plot(x,y,'-o,'MarkerIndices',[1 5 10]) displays a circle marker at the first, fifth, and tenth data
points.
Example: plot(x,y,'Marker','square','MarkerIndices',5) displays one square marker at the fifth data point.
An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue
components of the color. The intensities must be in the range [0,1]; for example, [0.4 0.6 0.7]. This table lists
the long and short color name options and the equivalent RGB triplet values.
'yellow' 'y' [1 1 0]
'magenta' 'm' [1 0 1]
'cyan' 'c' [0 1 1]
'red' 'r' [1 0 0]
'green' 'g' [0 1 0]
'blue' 'b' [0 0 1]
'white' 'w' [1 1 1]
'black' 'k' [0 0 0]
Example: 'blue'
'auto' Use the same color as the Color property for the axes.
RGB triplet or character vector of a color name Use the specified color.
An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue
components of the color. The intensities must be in the range [0,1]; for example, [0.4 0.6 0.7]. This table lists
the long and short color name options and the equivalent RGB triplet values.
'yellow' 'y' [1 1 0]
'magenta' 'm' [1 0 1]
'cyan' 'c' [0 1 1]
'red' 'r' [1 0 0]
'green' 'g' [0 1 0]
'blue' 'b' [0 0 1]
'white' 'w' [1 1 1]
'black' 'k' [0 0 0]
Example: 'green'
Example: 10
Format for datetime tick labels, specified as the comma-separated pair consisting of 'DatetimeTickFormat' and a
character vector of a date format. Use the letters A-Z and a-z to construct a custom format. These letters correspond
to the Unicode Locale Data Markup Language (LDML) standard for dates. You can include non-ASCII letter
characters such as a hyphen, space, or colon to separate the fields.
If you do not specify a value for 'DatetimeTickFormat', then plot automatically optimizes and updates the tick
labels based on the axis limits.
Example: 'DatetimeTickFormat','eeee, MMMM d, yyyy HH:mm:ss' displays a date and time such as
Saturday, April 19, 2014 21:41:06.
The following table shows several common display formats and examples of the formatted output for the date,
Saturday, April 19, 2014 at 9:41:06 PM in New York City.
'yyyy-MM-dd' 2014-04-19
'dd/MM/yyyy' 19/04/2014
'dd.MM.yyyy' 19.04.2014
http://in.mathworks.com/help/matlab/ref/plot.html 19/22
7/8/2017 2-D line plot - MATLAB plot - MathWorks India
For a complete list of valid letter identifiers, see the Format property for datetime arrays.
DatetimeTickFormat is not a chart line property. You must set the tick format using the name-value pair argument
when creating a plot. Alternatively, set the format using the xtickformat and ytickformat functions.
Format for duration tick labels, specified as the comma-separated pair consisting of 'DurationTickFormat' and a
character vector of a duration format.
If you do not specify a value for 'DurationTickFormat', then plot automatically optimizes and updates the tick
labels based on the axis limits.
To display a duration as a single number that includes a fractional part, for example, 1.234 hours, specify one of the
values in this table.
To display a duration in the form of a digital timer, specify one of these values.
'dd:hh:mm:ss'
'hh:mm:ss'
'mm:ss'
'hh:mm'
In addition, you can display up to nine fractional second digits by appending up to nine S characters.
DurationTickFormat is not a chart line property. You must set the tick format using the name-value pair argument
when creating a plot. Alternatively, set the format using the xtickformat and ytickformat functions.
Output Arguments
collapse all
http://in.mathworks.com/help/matlab/ref/plot.html 20/22