Difference between revisions of "Plot Commands"

From LIBISIS
Jump to navigation Jump to search
m
 
(27 intermediate revisions by the same user not shown)
Line 1: Line 1:
The main purpose of the graphics package is to plot graphs. Several different commands exist to facilitate this.
 
 
 
==One Dimensional Plots==
 
==One Dimensional Plots==
  
Line 30: Line 28:
 
|-
 
|-
 
!  | dp
 
!  | dp
| Marker and Lin with Errorbars Plot  
+
| Marker and Line with Errorbars Plot  
 
|}
 
|}
  
Line 37: Line 35:
 
'''Syntax:'''
 
'''Syntax:'''
  
<pre>>> dh(w, 'property', value, 'property2', value2,...)</pre>
+
<pre>>> dh(w, 'property', value, 'property2', value2,...)
 +
>> dh(rf, 'det',  'property', value, 'property2', value2,..)
 +
>> dh(rf, 'mon',  'property', value, 'property2', value2,..)
 +
>> dl(spectrum_no)</pre>
  
where w is a dataset and 'property' and value define [[General Behaviour#Property-Value Pairs|property-value pairs]]. See the functions for a list of properties that can be set.  
+
 
 +
* ww is an [[IXTdataset_1d]] array or [[IXTdataset_2d]],
 +
* 'property' and value define [[General Behaviour#Property-Value Pairs|property-value pairs]]. See the [[User Reference]] for a list of available properties.
 +
* rf is an [[IXTrunfile]] object.
 +
* If [[IXTrunfile]] command is called with 'mon' then the monitor data will be plotted, with 'det' the detector data will be plotted.  
 +
* Spectrum_no is a spectrum of the [[Input and Output Functions#Assigning a RAW File|currently assigned RAW file]] one wishes to plot (or array thereof)
  
 
===Overplots===
 
===Overplots===
  
If an overplot command is used, then the next plot will appear on top of the plot in the relevant plot window.  
+
If an overplot command is used, then the next plot will appear on top of any current plots existing in the appropriate window. The following overplot commands work when the existing plot is a one dimensional plot OR if given a name and tag, will overplot any plot type.  
  
 
{| {{Tablestyle}}
 
{| {{Tablestyle}}
Line 67: Line 73:
 
!  | pp
 
!  | pp
 
| Overplot Marker and Line with Errorbars  
 
| Overplot Marker and Line with Errorbars  
 +
|}
 +
 +
If the existing plot is not a one dimensional plot, then the following commands need to be used. For instance, if an area plot is made and a dispersion relation is fitted, then the fit can be plotted over the area plot. These are separate commands because an overplot will, by default, find the first open unheld one dimensional plot to use as its window. This is an easier way than using Name-Tags with the normal overplot commands.
 +
 +
{| {{Tablestyle}}
 +
|-
 +
! {{Headcellstyle}} | Command
 +
! {{Headcellstyle}} | Plot Type
 +
|-
 +
! | ploc
 +
| Overplot Line regardless of the nature of the current plot
 +
|-
 +
!  | pmoc
 +
| Overplot Marker regardless of the nature of the current plot
 +
|-
 +
!  | peoc
 +
| Overplot Errorbar regardless of the nature of the current plot
 +
|-
 +
!  | phoc
 +
| Overplot Histogram regardless of the nature of the current plot
 
|}
 
|}
  
 
===Plotting Arrays of [[IXTdataset_1d]]===
 
===Plotting Arrays of [[IXTdataset_1d]]===
  
If a one dimensional plot command is given an array of [[IXTdataset_1d]] objects then each [[IXTdataset_1d]] will be plotted as an overplot. Their order in the array is the same as the plotting order so that  
+
If the input to a one dimensional plot command is an array of [[IXTdataset_1d]] objects then each [[IXTdataset_1d]] will be plotted as an overplot. Their order in the array is the same as the plotting order so that  
  
 
<pre>>> dl(w, optional)</pre>
 
<pre>>> dl(w, optional)</pre>
Line 88: Line 114:
 
<pre>>> acolor('red', 'blue', 'green')
 
<pre>>> acolor('red', 'blue', 'green')
 
>> dl(w)</pre>
 
>> dl(w)</pre>
 +
  
 
Gives the following result
 
Gives the following result
Line 96: Line 123:
  
 
When a one dimensional plot is made of an [[IXTdataset_2d]] object then the [[IXTdataset_2d]] object is [[Special Functions#Expand Functions|expanded]] into an array of [[IXTdataset_1d]] objects and then plotted.
 
When a one dimensional plot is made of an [[IXTdataset_2d]] object then the [[IXTdataset_2d]] object is [[Special Functions#Expand Functions|expanded]] into an array of [[IXTdataset_1d]] objects and then plotted.
 +
  
 
==Two Dimensional Plots==
 
==Two Dimensional Plots==
 +
  
 
===Plot Types===
 
===Plot Types===
Line 123: Line 152:
 
'''Syntax:'''
 
'''Syntax:'''
  
<pre>>> ds(ww, 'property', value, 'property2', value2,...)</pre>
+
<pre>>> ds(ww, 'property', value, 'property2', value2,...)
 +
>> ds(rf, 'det',  'property', value, 'property2', value2,..)
 +
>> ds(rf, 'mon',  'property', value, 'property2', value2,..)
 +
>> da(spectrum_no)</pre>
 +
 
  
where w is a dataset and 'property' and value define [[General Behaviour#Property-Value Pairs|property-value pairs]]. See the functions for a list of properties that can be set.  
+
* ww is an [[IXTdataset_1d]] array or [[IXTdataset_2d]] or [[IXTpolygons]] object.
 +
* 'property' and value define [[General Behaviour#Property-Value Pairs|property-value pairs]]. See the [[User Reference]] for a list of available properties.
 +
* rf is an [[IXTrunfile]] object.
 +
* If [[IXTrunfile]] command is called with 'mon' then the monitor data will be plotted, with 'det' the detector data will be plotted.
 +
* Spectrum_no is an array of spectra from the [[Input and Output Functions#Assigning a RAW File| currently assigned RAW file]] one wishes to plot.
  
 
===Plotting Arrays of [[IXTdataset_1d]]===
 
===Plotting Arrays of [[IXTdataset_1d]]===
  
 +
An array of [[IXTdataset_1d]] objects is [[Special Functions#Conversion Functions|converted]] into an array of [[IXTdataset_2d]] objects and then plotted, if possible the [[IXTdataset_2d]] objects are [[Special Functions#Contract Functions|contracted]] into a single [[IXTdataset_2d]].
  
  
 
===Plotting Arrays of [[IXTdataset_2d]]===
 
===Plotting Arrays of [[IXTdataset_2d]]===
 +
 +
 +
====Area Plot and Multiplot====
 +
 +
 +
These plot each dataset on top of the last. So if data from two datasets overlap in an area plot, then the plotted data will be taken from the latest in the array.
 +
 +
 +
====Surface Plot====
 +
 +
A surface plot may be plotted in one of two different ways
 +
 +
* '''Combined''' (''Default'') - the data is combined and plotted as a single plot
 +
* '''Separate''' - different plots are made on the same axis, one for each dataset
 +
 +
 +
{| {{Tablestyle}}
 +
|-
 +
! {{Headcellstyle}} | &nbsp
 +
! {{Headcellstyle}} | Combined
 +
! {{Headcellstyle}} | Separate
 +
|-
 +
! {{Headcellstyle}} | Description
 +
| A set of points evenly distributed between the minimum and maximum values of all data are chosen. Signal data are then interpolated accross these points using linear interpolation.
 +
| Data are plotted in the order it appears in the array. No interpolation is done.
 +
|-
 +
! {{Headcellstyle}} | Useful For
 +
| Data that originates from the same run but has been split into many [[IXTdataset_2d]] objects or an array of [[IXTdataset_1d]] objects
 +
| Separate data that is to be displayed side by side
 +
|-
 +
! {{Headcellstyle}} | Computational Time and Memory
 +
| Long time with high memory cost to perform the interpolation. Only possible on small arrays
 +
| Minimal resources used
 +
|-
 +
! {{Headcellstyle}} | Syntax
 +
| >> ds(ww)
 +
| >> ds(ww, 'separation', 'on')
 +
|-
 +
! {{Headcellstyle}} | Images
 +
| [[image:Parta.jpg|300px|Combined data]]
 +
 +
| [[image:Partb.jpg|300px|Separated data]]
 +
 +
|-
 +
 +
|}
  
 
==Three Dimensional Plots==
 
==Three Dimensional Plots==
 +
  
 
===Sliceomatic===
 
===Sliceomatic===
 +
 +
Sliceomatic is a special addition to the graphics package and is not fully implimented. Optional settings are severely limited and many commands simiply don't work with Sliceomatic. It is a stand alone application. However, [[Retrospective Formatting#Figure Control Functions|keep_figure]] and name tags (see below) still work and are the most useful tools.
 +
 +
[[image:Sliceomatic.jpg|300px|Sliceomatic Plot]]
 +
 +
 +
'''Syntax'''
 +
 +
<pre>>> sm(d3a, optional)</pre>
 +
 +
here, d3a is an [[IXTdataset_3d]] object.
 +
  
 
==Optional Inputs==
 
==Optional Inputs==
 +
 +
All of the plotting commmands accept similar optional input arguments. Below are a few examples, see [[User Reference#Optional Inputs for Plots|here]] for a full list of optional inputs.
 +
 +
<pre>>> dl(w1, xlo, xhi, ylo, yhi)
 +
>> dl(w1, xlo, xhi)
 +
>> ds(ww, xlo, xhi, ylo, yhi, zlo, zhi)
 +
>> dl(w, 'color','green','title','myplot')
 +
>> da(w1, 'zlim', [0,0.1])</pre>
  
 
==Using Name Tags==
 
==Using Name Tags==
 +
 +
Names and Tags are used to identify plots and define properties for them. See [[Using Default Properties and Name Tags|here]] for more detailed information about properties and name tags.
 +
 +
Each plot with the same name and tag will have the same behaviour and default properties. They will plot into the same window (as long as it isn't on [[Retrospective Formatting#Figure Control Functions|hold]]) and replace its contents. When setting properties [[Pre-Emptive Formatting|pre-emptively]] name tags may be given so that only properties of certain plots are changed.
 +
 +
 +
 +
'''Syntax:'''
 +
 +
<pre>>>dl(w1, 'name', 'myname', 'tag', 'mytag')</pre>
 +
 +
By default each plot ''type'' has a different name and all tags are blank
 +
 +
{| {{Tablestyle}}
 +
|-
 +
! {{Headcellstyle}} | Plot Type
 +
! {{Headcellstyle}} | Default Name
 +
|-
 +
! | Oned (histogram, line, errorbar and marker)
 +
| 'default one dimensional plot'
 +
|-
 +
!  | Area
 +
| 'default area plot'
 +
|-
 +
!  | Surface
 +
| 'default surface plot'
 +
|-
 +
!  | Multiplot
 +
| 'default multiplot'
 +
|-
 +
!  | Sliceomatic
 +
| 'Sliceomatic'
 +
|}
 +
 +
Therefore, by default, each of these plot types will have their own figure window when plotting, but plots of the same type will replace each other unless they are [[Retrospective Formatting#Figure Control Functions|held]].

Latest revision as of 10:27, 22 October 2009

One Dimensional Plots

Plot Types

Images of the one dimensional plot types can be seen here.


Command Plot Type
dl Line Plot
dm Marker Plot
de Errorbar Plot
dh Histogram Plot
dp Marker with Errorbars Plot
dp Marker and Line with Errorbars Plot


Syntax:

>> dh(w, 'property', value, 'property2', value2,...)
>> dh(rf, 'det',  'property', value, 'property2', value2,..)
>> dh(rf, 'mon',  'property', value, 'property2', value2,..)
>> dl(spectrum_no)


Overplots

If an overplot command is used, then the next plot will appear on top of any current plots existing in the appropriate window. The following overplot commands work when the existing plot is a one dimensional plot OR if given a name and tag, will overplot any plot type.

Command Plot Type
pl Overplot Line
pm Overplot Marker
pe Overplot Errorbar
ph Overplot Histogram
pp Overplot Marker with Errorbars
pp Overplot Marker and Line with Errorbars

If the existing plot is not a one dimensional plot, then the following commands need to be used. For instance, if an area plot is made and a dispersion relation is fitted, then the fit can be plotted over the area plot. These are separate commands because an overplot will, by default, find the first open unheld one dimensional plot to use as its window. This is an easier way than using Name-Tags with the normal overplot commands.

Command Plot Type
ploc Overplot Line regardless of the nature of the current plot
pmoc Overplot Marker regardless of the nature of the current plot
peoc Overplot Errorbar regardless of the nature of the current plot
phoc Overplot Histogram regardless of the nature of the current plot

Plotting Arrays of IXTdataset_1d

If the input to a one dimensional plot command is an array of IXTdataset_1d objects then each IXTdataset_1d will be plotted as an overplot. Their order in the array is the same as the plotting order so that

>> dl(w, optional)

is the same as

for i = 1:length(ww)
    pl(w(i), optional)
end


EXAMPLE:

If w is a 4 element array of IXTdataset_1d objects then

>> acolor('red', 'blue', 'green')
>> dl(w)


Gives the following result

Plot of array of IXTdataset_1d objects

Plotting Arrays of IXTdataset_2d

When a one dimensional plot is made of an IXTdataset_2d object then the IXTdataset_2d object is expanded into an array of IXTdataset_1d objects and then plotted.


Two Dimensional Plots

Plot Types

Images of the two dimensional plot types can be seen here.


Command Plot Type
da Area Plot
ds Surface Plot
mp Multiplot Plot


Syntax:

>> ds(ww, 'property', value, 'property2', value2,...)
>> ds(rf, 'det',  'property', value, 'property2', value2,..)
>> ds(rf, 'mon',  'property', value, 'property2', value2,..)
>> da(spectrum_no)


Plotting Arrays of IXTdataset_1d

An array of IXTdataset_1d objects is converted into an array of IXTdataset_2d objects and then plotted, if possible the IXTdataset_2d objects are contracted into a single IXTdataset_2d.


Plotting Arrays of IXTdataset_2d

Area Plot and Multiplot

These plot each dataset on top of the last. So if data from two datasets overlap in an area plot, then the plotted data will be taken from the latest in the array.


Surface Plot

A surface plot may be plotted in one of two different ways

  • Combined (Default) - the data is combined and plotted as a single plot
  • Separate - different plots are made on the same axis, one for each dataset


&nbsp Combined Separate
Description A set of points evenly distributed between the minimum and maximum values of all data are chosen. Signal data are then interpolated accross these points using linear interpolation. Data are plotted in the order it appears in the array. No interpolation is done.
Useful For Data that originates from the same run but has been split into many IXTdataset_2d objects or an array of IXTdataset_1d objects Separate data that is to be displayed side by side
Computational Time and Memory Long time with high memory cost to perform the interpolation. Only possible on small arrays Minimal resources used
Syntax >> ds(ww) >> ds(ww, 'separation', 'on')
Images Combined data Separated data

Three Dimensional Plots

Sliceomatic

Sliceomatic is a special addition to the graphics package and is not fully implimented. Optional settings are severely limited and many commands simiply don't work with Sliceomatic. It is a stand alone application. However, keep_figure and name tags (see below) still work and are the most useful tools.

Sliceomatic Plot


Syntax

>> sm(d3a, optional)

here, d3a is an IXTdataset_3d object.


Optional Inputs

All of the plotting commmands accept similar optional input arguments. Below are a few examples, see here for a full list of optional inputs.

>> dl(w1, xlo, xhi, ylo, yhi)
>> dl(w1, xlo, xhi)
>> ds(ww, xlo, xhi, ylo, yhi, zlo, zhi)
>> dl(w, 'color','green','title','myplot')
>> da(w1, 'zlim', [0,0.1])

Using Name Tags

Names and Tags are used to identify plots and define properties for them. See here for more detailed information about properties and name tags.

Each plot with the same name and tag will have the same behaviour and default properties. They will plot into the same window (as long as it isn't on hold) and replace its contents. When setting properties pre-emptively name tags may be given so that only properties of certain plots are changed.


Syntax:

>>dl(w1, 'name', 'myname', 'tag', 'mytag')

By default each plot type has a different name and all tags are blank

Plot Type Default Name
Oned (histogram, line, errorbar and marker) 'default one dimensional plot'
Area 'default area plot'
Surface 'default surface plot'
Multiplot 'default multiplot'
Sliceomatic 'Sliceomatic'

Therefore, by default, each of these plot types will have their own figure window when plotting, but plots of the same type will replace each other unless they are held.