About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2007

URL: http://cxc.harvard.edu/chips4.0/make_figure.py.html
Hardcopy (PDF): A4 | Letter
AHELP for ChIPS 4.0 make_figure Context: py.chips

Synopsis

Draw a curve, contour, or histogram together with axis labels.

Syntax

make_figure ([id,] filename|Crate [,figuretype] [,attributes])

Description

  • id - an optional ChipsId structure containing values to modify the currency state for the command or a string id to modify a label within the current frame.
  • filename or crate - input data, specified as a filename (which can include the DM virtual-file syntax such as column specifiers) or a Crate object (e.g. as returned by the read_file command).
  • figuretype - a string identifying the type of figure to create: "curve", "contour", or "histogram". If omitted, the figuretype is determined from the input data.
  • attributes - optional parameters which allow the user to configure properties though a structure, list, or attribute string.

The make_figure command creates a curve, contour, or histogram from the data provided. If an existing plot is current, it is cleared and the figure is drawn in that plot. If there is no current plot, one is created and the figure is placed in it.

Choice of figure type

By default, table data is used to create a curve and image data is used to create a contour. Specifying a figuretype overrides this behavior, e.g. to create a histogram. When creating a histogram, the two columns are used as bins and counts.

Axis labels

Axis labels and units are drawn if the information is available in the input file. Plot titles are set to the value of the file keyword OBJECT or TITLE, or from the input filename (without the path and virtual filter specfications).

Changing attribute values

The attributes option can be used to control figure characteristics. The attributes can be set to the ChIPS defaults, values provided in the make_figure command, or values from the user's preference file. Refer to the individual help files - "ahelp py.chips set_curve", "ahelp py.chips set_contour", and "ahelp py.chips set_histogram" - for information on the attributes of each object.

Example 1

chips> make_figure("source.dat")

If the file "source.dat" contains

 unix% cat source.dat
 # alpha beta error
 1 2 0.7
 4 9 2.2
 9 15 3.4

then the make_figure call will plot this as a curve with symmetrical y errors, since there are three columns in the input file. As the file contains a header line, the column names are set to "alpha" and "beta".

Example 2

chips> make_figure("flare.fits[cols time_bin,count_rate]")

Create a curve of the time_bin and count_rate columns from the file "flare.fits". The plot title is set to the value of the OBJECT keyword in "flare.fits" (if it exists).

Example 3

chips> make_figure("img.fits", "color=green thickness=2")

Create contours from the file "img.fits". Set the contour color to green and the thickness to 2.

If the image contains WCS information, then it will be used for the X and Y axes; in this case you may wish to change the tick label format to use sexagesimal notation by saying:

chips> set_xaxis(["tickformat","ra"])
chips> reverse_axes(X_AXIS)
chips> set_yaxis(["tickformat","dec"])

Example 4

chips> make_figure("peak.fits[cols energy,counts]", "histogram",
"line.style=shortdash line.color=yellow")

Create a histogram from the file "peak.fits" with a short-dashed yellow line.

Bugs

See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.

Hardcopy (PDF): A4 | Letter
Last modified: December 2007



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.