Package asap :: Module asapplotter :: Class asapplotter
[show private | hide private]
[frames | no frames]

Class asapplotter


The ASAP plotter.
By default the plotter is set up to plot polarisations
'colour stacked' and scantables across panels.
Note:
    Currenly it only plots 'spectra' not Tsys or
    other variables.

Method Summary
  __init__(self, visible)
  arrow(self, *args, **kwargs)
Draws arrow on specified axis from (x,y) to (x+dx,y+dy).
  axhline(self, *args, **kwargs)
AXHLINE(y=0, xmin=0, xmax=1, **kwargs) Axis Horizontal Line Draw a horizontal line at y from xmin to xmax.
  axhspan(self, *args, **kwargs)
AXHSPAN(ymin, ymax, xmin=0, xmax=1, **kwargs) Axis Horizontal Span.
  axvline(self, *args, **kwargs)
AXVLINE(x=0, ymin=0, ymax=1, **kwargs) Axis Vertical Line Draw a vertical line at x from ymin to ymax.
  axvspan(self, *args, **kwargs)
AXVSPAN(xmin, xmax, ymin=0, ymax=1, **kwargs) axvspan : Axis Vertical Span.
  plot(self, scan)
Plot a scantable.
  plot_lines(self, linecat, doppler, deltachan, rotate, location)
Plot a line catalog.
  save(self, filename, orientation, dpi)
Save the plot to a file.
  set_abcissa(self, abcissa, fontsize)
Set the x-axis label of the plot.
  set_colors(self, colmap)
Set the colours to be used.
  set_colours(self, colmap)
Set the colours to be used.
  set_font(self, family, style, weight, size)
Set font properties.
  set_histogram(self, hist, linewidth)
Enable/Disable histogram-like plotting.
  set_layout(self, rows, cols)
Set the multi-panel layout, i.e.
  set_legend(self, mp, fontsize, mode)
Specify a mapping for the legend instead of using the default indices: Parameters: mp: a list of 'strings'.
  set_linestyles(self, linestyles, linewidth)
Set the linestyles to be used.
  set_mask(self, mask, selection)
Set a plotting mask for a specific polarization.
  set_mode(self, stacking, panelling)
Set the plots look and feel, i.e.
  set_ordinate(self, ordinate, fontsize)
Set the y-axis label of the plot.
  set_panelling(self, what)
  set_range(self, xstart, xend, ystart, yend)
Set the range of interest on the abcissa of the plot Parameters: [x,y]start,[x,y]end: The start and end points of the 'zoom' window Note: These become non-sensical when the unit changes.
  set_selection(self, selection, refresh)
  set_stacking(self, what)
  set_title(self, title, fontsize)
Set the title of the plot.
  text(self, *args, **kwargs)
TEXT(x, y, s, fontdict=None, **kwargs) Add text in string s to axis at location x,y (data coords) fontdict is a dictionary to override the default text properties.

Method Details

arrow(self, *args, **kwargs)

Draws arrow on specified axis from (x,y) to (x+dx,y+dy).

axhline(self, *args, **kwargs)

AXHLINE(y=0, xmin=0, xmax=1, **kwargs)

Axis Horizontal Line

Draw a horizontal line at y from xmin to xmax.  With the default
values of xmin=0 and xmax=1, this line will always span the horizontal
extent of the axes, regardless of the xlim settings, even if you
change them, eg with the xlim command.  That is, the horizontal extent
is in axes coords: 0=left, 0.5=middle, 1.0=right but the y location is
in data coordinates.

Return value is the Line2D instance.  kwargs are the same as kwargs to
plot, and can be used to control the line properties.  Eg

  # draw a thick red hline at y=0 that spans the xrange
  axhline(linewidth=4, color='r')

  # draw a default hline at y=1 that spans the xrange
  axhline(y=1)

  # draw a default hline at y=.5 that spans the the middle half of
  # the xrange
  axhline(y=.5, xmin=0.25, xmax=0.75)

axhspan(self, *args, **kwargs)

AXHSPAN(ymin, ymax, xmin=0, xmax=1, **kwargs)

Axis Horizontal Span.  ycoords are in data units and x
coords are in axes (relative 0-1) units

Draw a horizontal span (regtangle) from ymin to ymax.  With the
default values of xmin=0 and xmax=1, this always span the xrange,
regardless of the xlim settings, even if you change them, eg with the
xlim command.  That is, the horizontal extent is in axes coords:
0=left, 0.5=middle, 1.0=right but the y location is in data
coordinates.

kwargs are the kwargs to Patch, eg

  antialiased, aa
  linewidth,   lw
  edgecolor,   ec
  facecolor,   fc

the terms on the right are aliases

Return value is the patches.Polygon instance.

    #draws a gray rectangle from y=0.25-0.75 that spans the horizontal
    #extent of the axes
    axhspan(0.25, 0.75, facecolor='0.5', alpha=0.5)

axvline(self, *args, **kwargs)

AXVLINE(x=0, ymin=0, ymax=1, **kwargs)

Axis Vertical Line

Draw a vertical line at x from ymin to ymax.  With the default values
of ymin=0 and ymax=1, this line will always span the vertical extent
of the axes, regardless of the xlim settings, even if you change them,
eg with the xlim command.  That is, the vertical extent is in axes
coords: 0=bottom, 0.5=middle, 1.0=top but the x location is in data
coordinates.

Return value is the Line2D instance.  kwargs are the same as
kwargs to plot, and can be used to control the line properties.  Eg

    # draw a thick red vline at x=0 that spans the yrange
    l = axvline(linewidth=4, color='r')

    # draw a default vline at x=1 that spans the yrange
    l = axvline(x=1)

    # draw a default vline at x=.5 that spans the the middle half of
    # the yrange
    axvline(x=.5, ymin=0.25, ymax=0.75)

axvspan(self, *args, **kwargs)

AXVSPAN(xmin, xmax, ymin=0, ymax=1, **kwargs)

axvspan : Axis Vertical Span.  xcoords are in data units and y coords
are in axes (relative 0-1) units

Draw a vertical span (regtangle) from xmin to xmax.  With the default
values of ymin=0 and ymax=1, this always span the yrange, regardless
of the ylim settings, even if you change them, eg with the ylim
command.  That is, the vertical extent is in axes coords: 0=bottom,
0.5=middle, 1.0=top but the y location is in data coordinates.

kwargs are the kwargs to Patch, eg

  antialiased, aa
  linewidth,   lw
  edgecolor,   ec
  facecolor,   fc

the terms on the right are aliases

return value is the patches.Polygon instance.

    # draw a vertical green translucent rectangle from x=1.25 to 1.55 that
    # spans the yrange of the axes
    axvspan(1.25, 1.55, facecolor='g', alpha=0.5)

plot(self, scan=None)

Plot a scantable.
Parameters:
    scan:   a scantable
Note:
    If a scantable was specified in a previous call
    to plot, no argument has to be given to 'replot'
    NO checking is done that the abcissas of the scantable
    are consistent e.g. all 'channel' or all 'velocity' etc.

plot_lines(self, linecat=None, doppler=0.0, deltachan=10, rotate=90.0, location=None)

Plot a line catalog.
Parameters:
    linecat:      the linecatalog to plot
    doppler:      the velocity shift to apply to the frequencies
    deltachan:    the number of channels to include each side of the
                  line to determine a local maximum/minimum
    rotate:       the rotation (in degrees) )for the text label (default 90.0)
    location:     the location of the line annotation from the 'top',
                  'bottom' or alternate (None - the default)
Notes:
If the spectrum is flagged no line will be drawn in that location.

save(self, filename=None, orientation=None, dpi=None)

Save the plot to a file. The know formats are 'png', 'ps', 'eps'.
Parameters:
     filename:    The name of the output file. This is optional
                  and autodetects the image format from the file
                  suffix. If non filename is specified a file
                  called 'yyyymmdd_hhmmss.png' is created in the
                  current directory.
     orientation: optional parameter for postscript only (not eps).
                  'landscape', 'portrait' or None (default) are valid.
                  If None is choosen for 'ps' output, the plot is
                  automatically oriented to fill the page.
     dpi:         The dpi of the output non-ps plot

set_abcissa(self, abcissa=None, fontsize=None)

Set the x-axis label of the plot. If multiple panels are plotted,
multiple labels have to be specified.
Parameters:
    abcissa:     a list of abcissa labels. None (default) let
                 data determine the labels
Example:
     # two panels are visible on the plotter
     plotter.set_ordinate(["First X-Axis","Second X-Axis"])

set_colors(self, colmap)

Set the colours to be used. The plotter will cycle through
these colours when lines are overlaid (stacking mode).
Parameters:
    colmap:     a list of colour names
Example:
     plotter.set_colors("red green blue")
     # If for example four lines are overlaid e.g I Q U V
     # 'I' will be 'red', 'Q' will be 'green', U will be 'blue'
     # and 'V' will be 'red' again.

set_colours(self, colmap)

Set the colours to be used. The plotter will cycle through
these colours when lines are overlaid (stacking mode).
Parameters:
    colmap:     a list of colour names
Example:
     plotter.set_colors("red green blue")
     # If for example four lines are overlaid e.g I Q U V
     # 'I' will be 'red', 'Q' will be 'green', U will be 'blue'
     # and 'V' will be 'red' again.

set_font(self, family=None, style=None, weight=None, size=None)

Set font properties.
Parameters:
    family:    one of 'sans-serif', 'serif', 'cursive', 'fantasy', 'monospace'
    style:     one of 'normal' (or 'roman'), 'italic'  or 'oblique'
    weight:    one of 'normal or 'bold'
    size:      the 'general' font size, individual elements can be adjusted
               seperately

set_histogram(self, hist=True, linewidth=None)

Enable/Disable histogram-like plotting.
Parameters:
    hist:        True (default) or False. The fisrt default
                 is taken from the .asaprc setting
                 plotter.histogram

set_layout(self, rows=None, cols=None)

Set the multi-panel layout, i.e. how many rows and columns plots
are visible.
Parameters:
     rows:   The number of rows of plots
     cols:   The number of columns of plots
Note:
     If no argument is given, the potter reverts to its auto-plot
     behaviour.

set_legend(self, mp=None, fontsize=None, mode=0)

Specify a mapping for the legend instead of using the default
indices:
Parameters:
    mp:        a list of 'strings'. This should have the same length
               as the number of elements on the legend and then maps
               to the indeces in order. It is possible to uses latex
               math expression. These have to be enclosed in r'',
               e.g. r'$x^{2}$'
    fontsize:  The font size of the label (default None)
    mode:      where to display the legend
               Any other value for loc else disables the legend:
                0: auto
                1: upper right
                2: upper left
                3: lower left
                4: lower right
                5: right
                6: center left
                7: center right
                8: lower center
                9: upper center
                10: center

Example:
     If the data has two IFs/rest frequencies with index 0 and 1
     for CO and SiO:
     plotter.set_stacking('i')
     plotter.set_legend(['CO','SiO'])
     plotter.plot()
     plotter.set_legend([r'$^{12}CO$', r'SiO'])

set_linestyles(self, linestyles=None, linewidth=None)

Set the linestyles to be used. The plotter will cycle through
these linestyles when lines are overlaid (stacking mode) AND
only one color has been set.
Parameters:
     linestyles:     a list of linestyles to use.
                     'line', 'dashed', 'dotted', 'dashdot',
                     'dashdotdot' and 'dashdashdot' are
                     possible

Example:
     plotter.set_colors("black")
     plotter.set_linestyles("line dashed dotted dashdot")
     # If for example four lines are overlaid e.g I Q U V
     # 'I' will be 'solid', 'Q' will be 'dashed',
     # U will be 'dotted' and 'V' will be 'dashdot'.

set_mask(self, mask=None, selection=None)

Set a plotting mask for a specific polarization.
This is useful for masking out "noise" Pangle outside a source.
Parameters:
     mask:           a mask from scantable.create_mask
     selection:      the spectra to apply the mask to.
Example:
     select = selector()
     select.setpolstrings("Pangle")
     plotter.set_mask(mymask, select)

set_mode(self, stacking=None, panelling=None)

Set the plots look and feel, i.e. what you want to see on the plot.
Parameters:
    stacking:     tell the plotter which variable to plot
                  as line colour overlays (default 'pol')
    panelling:    tell the plotter which variable to plot
                  across multiple panels (default 'scan'
Note:
    Valid modes are:
         'beam' 'Beam' 'b':     Beams
         'if' 'IF' 'i':         IFs
         'pol' 'Pol' 'p':       Polarisations
         'scan' 'Scan' 's':     Scans
         'time' 'Time' 't':     Times

set_ordinate(self, ordinate=None, fontsize=None)

Set the y-axis label of the plot. If multiple panels are plotted,
multiple labels have to be specified.
Parameters:
    ordinate:    a list of ordinate labels. None (default) let
                 data determine the labels
Example:
     # two panels are visible on the plotter
     plotter.set_ordinate(["First Y-Axis","Second Y-Axis"])

set_range(self, xstart=None, xend=None, ystart=None, yend=None)

Set the range of interest on the abcissa of the plot
Parameters:
    [x,y]start,[x,y]end:  The start and end points of the 'zoom' window
Note:
    These become non-sensical when the unit changes.
    use plotter.set_range() without parameters to reset

set_title(self, title=None, fontsize=None)

Set the title of the plot. If multiple panels are plotted,
multiple titles have to be specified.
Example:
     # two panels are visible on the plotter
     plotter.set_title(["First Panel","Second Panel"])

text(self, *args, **kwargs)

TEXT(x, y, s, fontdict=None, **kwargs)

Add text in string s to axis at location x,y (data coords)

  fontdict is a dictionary to override the default text properties.
  If fontdict is None, the defaults are determined by your rc
  parameters.

  withdash=True will create a TextWithDash instance instead
  of a Text instance.

Individual keyword arguemnts can be used to override any given
parameter

    text(x, y, s, fontsize=12)

The default transform specifies that text is in data coords,
alternatively, you can specify text in axis coords (0,0 lower left and
1,1 upper right).  The example below places text in the center of the
axes

    text(0.5, 0.5,'matplotlib',
         horizontalalignment='center',
         verticalalignment='center',
         transform = ax.transAxes,
    )

Generated by Epydoc 2.1 on Wed May 2 14:24:32 2007 http://epydoc.sf.net