Difference between revisions of "Pre-Emptive Formatting"

From LIBISIS
Jump to navigation Jump to search
m
 
m
Line 1: Line 1:
 +
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==
 
==General Syntax==
 +
 +
<pre>>> property(value1, value2, ...)</pre>
 +
 +
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
 +
 +
<pre>>> property(value1, value2, value3)
 +
>> dl(w)
 +
>> pl(w2)
 +
>> pm(w3)
 +
>> pe(w4)</pre>
 +
 +
is equivilent to
 +
 +
<pre>>> property(value1)
 +
>> dl(w)
 +
>> property(value2)
 +
>> pl(w2)
 +
>> property(value3)
 +
>> pm(w3)
 +
>> property(value1)
 +
>> pe(w4)</pre>
 +
  
 
==Colors==
 
==Colors==
 +
To set the colour of markers and lines in plots use the command
 +
 +
<pre>>> acolor('color')</pre>
 +
 +
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==
 
==Lines==
 +
 +
To set the width and type of line use the command
 +
 +
<pre>>> aline('linestyle')
 +
>> aline(linewidth)
 +
>> aline('linestyle', linewidth)</pre>
 +
 +
where linewidth is a number. Valid linestyles are given [[User Reference#Valid Linestyles|here]].
 +
  
 
==Markers==
 
==Markers==
 +
 +
To set the marker style and width use the command
 +
 +
<pre>>> amark('marker style')
 +
>> amark(markerwidth)
 +
>> amark('marker style', markerwidth</pre>
 +
 +
where markerwidth is a number. Valid marker styles are given [[User Reference#Valid Marker Styles|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
 +
 +
<pre>>> property(name, tag, value1, value2, value3,...)</pre>
 +
 +
now only plots that are made with the command
 +
 +
<pre>>> plottype(w, name, tag)</pre>
 +
 +
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
 +
 +
<pre>>> acolor('red', 'green', 'blue')
 +
>> amark('o', 3, '*', 4, 'o', 1)
 +
>> aline('--', 5, '.-', 2)
 +
>> acolor('toby', 'plot', 'k', 'y')
 +
>> amark('toby', 'plot', 2)</pre>
 +
 +
then the following would happen under various circumstances
 +
 +
 +
{| {{Tablestyle}}
 +
|-
 +
! {{Headcellstyle}} | Commands Given
 +
! {{Headcellstyle}} | Result
 +
! {{Headcellstyle}} | Reason
 +
|-
 +
>> [[Plot Commands#One Dimensional Plots|dl]](w1)
 +
>> [[Plot Commands#Overplots|pl]](w2)
 +
>> [[Plot Commands#Overplots|pm]](w2,'color','red')
 +
>> [[Plot Commands#One Dimensional Plots|dl]](w1,'name','Dickon plot','tag','')
 +
| Line Plot
 +
| Line Plot
 +
|-
 +
!  | dm
 +
| Marker Plot
 +
|-
 +
!  | de
 +
| Errorbar Plot
 +
|-
 +
!  | dh
 +
| Histogram Plot
 +
|-
 +
!  | dp
 +
| Marker with Errorbars Plot
 +
|-
 +
!  | dp
 +
| Marker and Line with Errorbars Plot
 +
|}

Revision as of 14:34, 19 March 2008

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


>> dl(w1) >> pl(w2) >> pm(w2,'color','red') >> dl(w1,'name','Dickon plot','tag',)
Commands Given Result Reason
Line Plot Line Plot
dm Marker Plot
de Errorbar Plot
dh Histogram Plot
dp Marker with Errorbars Plot
dp Marker and Line with Errorbars Plot