Graphics |
You can assign different line styles to each data set by passing line style identifier strings to plot
. For example,
The graph shows three lines of different colors and lines styles representing the value of the sine function with a small phase shift between each line, as defined by y
, y2
, and y3
. The lines are blue solid, green dashed, and red dotted.
Colors, Line Styles, and Markers
The basic plotting functions accepts character-string arguments that specify various line styles, marker symbols, and colors for each vector plotted. In the general form,
linestyle_marker_color
is a character string (delineated by single quotation marks) constructed from
x
, *
, o
, etc.)
c
, m
, y
, k
, r
, g
, b
, w
)
plots a yellow dotted line and places square markers at each data point. If you specify a marker type, but not a line style, MATLAB draws only the marker.
The specification can consist of one or none of each specifier in any order. For example, the string
defines a dashed line with circular markers, both colored green.
You can also specify the size of the marker and, for markers that are closed shapes, you can specify separately the colors of the edges and the face.
See the LineSpec
discussion for more information.
Creating Line Plots | Specifying the Color and Size of Lines |
© 1994-2005 The MathWorks, Inc.