Pre-Emptive Formatting
Many settings can be made before a plot is constructed. For instance, one can select the colour that a line will be before the line is drawn.
General Syntax
>> property(value1, value2, ...)
This will set the property to the values selected. When more than one value is chosen, the values are used on plots in the order they are input so that
>> property(value1, value2, value3) >> dl(w) >> pl(w2) >> pm(w3) >> pe(w4)
is equivilent to
>> property(value1) >> dl(w) >> property(value2) >> pl(w2) >> property(value3) >> pm(w3) >> property(value1) >> pe(w4)
Colors
To set the colour of markers and lines in plots use the command
>> acolor('color')
where 'color' may be a standard matlab character:
'r', 'g', 'b', 'c', 'm', 'y', 'k', 'w'
or any of the colour names
'red', 'geen', 'blue', 'cyan', 'magenta', 'yellow', 'black', 'white'
Lines
To set the width and type of line use the command
>> aline('linestyle') >> aline(linewidth) >> aline('linestyle', linewidth)
where linewidth is a number. Valid linestyles are given here.
Markers
To set the marker style and width use the command
>> amark('marker style') >> amark(markerwidth) >> amark('marker style', markerwidth
where markerwidth is a number. Valid marker styles are given here.
Using Name Tags
When a plot is made, it may be given a name and a tag. If you only want to change the properties of plots with a particular name and tag then use the syntax
>> property(name, tag, value1, value2, value3,...)
now only plots that are made with the command
>> plottype(w, name, tag)
will have the properties that have been set. All other plots will retain whatever global properties were set previously.
See Using Default Properties and Name Tags for further information.
Examples
If the following properties are set
>> acolor('red', 'green', 'blue') >> amark('o', 3, '*', 4, 'o', 1) >> aline('--', 5, '.-', 2) >> acolor('toby', 'plot', 'k', 'y') >> amark('toby', 'plot', 2)
then the following would happen under various circumstances
Commands Given | Result | Reason |
---|---|---|
>> dl(w1)
>> pl(w2) >> pm(w2,'color','red') >> dl(w1,'name','Dickon plot','tag',) |
Line plot of w1 in red
Line over plot of w2 in green Marker over plot of w2 in red New figure line plot of w1 in red |
First plot is set to red
Follows next color set in acolor Properties set at plot level over-ride pre-determined defaults Name tag given, so new window and uses the first colour |
dm | Marker Plot | |
de | Errorbar Plot | |
dh | Histogram Plot | |
dp | Marker with Errorbars Plot | |
dp | Marker and Line with Errorbars Plot |