A convenient module for plotting in CASSIS

Last update:12/06/14

Description

The Plot class is a simple class to plot data in CASSIS with the scripts:

import ScriptEnvironment
from Plot import Plot

Usage

  • Initialize a plot:

    >>> p = Plot("Some title for the frame")
    
  • Create a simple plot with x and y data:

    >>> p.plot(x, y)
    
  • Add another plot:

    >>> p.add(x2, y2)
    
  • Close the plot:

    >>> p.close()
    
  • Clear the frame:

    >>> p.clear()
    

Options

The plot method provides options to modify the appearance of the plot.

  • title: set the title
  • legend: set the legend (for multiple plots the legend must be unique.)
  • xlabel and ylabel: set the labels of the x and y axes
  • lineWidth: set the width of the line
  • lineStyle: set the style of the line. The available values are “line”, “dash” or “dot”
  • lineColor: set the color of the line (example: “red”, “blue”, “pink”)
  • symbol: set the symbol. The available symbols are “d”, “x”, “+”, “^”, “rectangle” and “circle”

Examples:

# A plot with blue dashed line, a title and labels for x and y
p.plot(x, y, title="Mean intensities of the spectra",
ylabel="Intensity (K)", xlabel="Index", lineColor="blue", lineStyle="dash")

# A multiplot with "+", "^" and different legends for the data
p.plot(x1, y1, symbol="+", lineColor="black", legend="CO")
p.add(x2, y2, symbol="^", lineColor="magenta", legend="CH3OH")

Limitations

  • Plot doesn’t provide error bars.
  • With multiple plots, a given plot cannot be removed. You have to recreate the plots

Table Of Contents

Related Topics

This Page