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/add_curve.sl.html
AHELP for ChIPS 4.0 add_curve Context: sl.chips

Synopsis

Creates a curve.

Syntax

add_curve( [ChipsId,] filename [,attributes]);
add_curve( [ChipsId,] TABLECrate [,attributes]);
add_curve( [ChipsId,] x, y [,attributes]);
add_curve( [ChipsId,] x, y, error_list|NULL [,attributes]);
add_curve( [ChipsId,] x, y, error_list|NULL, limits_list|NULL
[,attributes]);

Description

  • ChipsId - an optional ChipsId structure containing values to modify the currency state for the command.
  • TABLECrate/filename - input data, specified as a filename or a TABLECrate ("ahelp sl.crates crates")
  • x - array of x data points
  • y - array of y data points
  • error_list - optional list of up to four error arrays. One array = symmetrical y errors. Two arrays = ydown and yup errors. Three arrays = ydown, yup, and xdown errors. Four arrays = ydown, yup, xdown, and xup errors.
  • limits_list - optional list of upper and/or lower limits. The list may be empty, y limits, or y and x limits.
  • attributes - optional parameters which allow the user to configure properties though a structure, list, or attribute string.

The add_curve command creates a curve whose attributes are specified by user preferences or in an attribute list. The new curve becomes current by default; providing a ChipsId overrides the currency state. A curve needs a minimum of a pair of numeric data arrays of the same length to plot.

If an existing plot is current, the curve is added to that plot. If there is no current plot, one is created and the curve is placed in it. To overplot curves, simply add them all to the same plot object.

Up to six additional data columns may be provided as error and limits information. The error and limits information is interpreted based on how many columns are supplied to the command, as described above. On account of this, an entry for the error_list array must be provided in order to include limits data. If no error_list is needed, the value "NULL" may be used.

Customizing the Curve

There are several attributes that control the curve characteristics. The attributes can be set to the ChIPS defaults, values provided in the add_curve command, or values from the user's preference file.

The attributes may also be modified with the set_curve command at any time; see "ahelp sl.chips set_curve" and "ahelp sl.chips setget" for more information.

The attributes associated with curves are:

Attribute Description Options Default
baddata How to handle NaNs and +/-infs in data omit - discard bad data point and leave gap ignore - discard bad point but connect prev good w/ next omit
depth Integer value indicating line depth see the Depth section of "ahelp sl.chips chipsopt" 100
err.color Color of the curve err bars see the Color section of "ahelp sl.chips chipsopt" default
err.down Plot y down errors if data provided true/false true
err.left Plot x down errors if data provided true/false true
err.right Plot x up errors if data provided true/false true
err.style Specifies the error bar style bar|line|cap (bar and line are identical) line
err.thickness Specifies the thickness of error bars 0.5:9; see the Thickness). 1
err.up Plot y up errors if data provided true/false true
limitlength Length of the bars for upper and lower limits 0:1 in plot normalized coordinates 0.05
limitoverride Should both the limit and the error bar be drawn on a point? true = hide the errors, false = show the errors; see the Booleans section of "ahelp sl.chips chipsopt" true
line.color Color of the curve line see the Color section of "ahelp sl.chips chipsopt" default
line.style the pattern used for the curve line style see the Line Style section of "ahelp sl.chips chipsopt" solid
line.thickness Thickness of the curve line see the Thickness section of "ahelp sl.chips chipsopt" 1
stem Stem used for curve id Alphanumeric crv
symbol.angle The angle of rotation for the curve symbols -360.0:360.0 0.0
symbol.color Color of the curve symbols see the Color section of "ahelp sl.chips chipsopt" default
symbol.fill Should the curve symbols be filled or not see the Booleans section of "ahelp sl.chips chipsopt" true
symbol.size Size of the curve symbols 1:100 2
symbol.style The shape of the glyph used as the curve symbols see the Symbol Style section of "ahelp sl.chips chipsopt" cross

Example 1

chips> add_curve("lc.fits[cols time, count_rate]");

Plot the time versus count_rate columns from the FITS file "lc.fits". The Data Model virtual filter syntax "[cols time, count_rate]" is used to select the X and Y columns from the file.

Example 2

chips> add_curve("lc.fits[cols time, count_rate]",{"line.color","red"});

Plot the time versus count_rate columns from the FITS file "lc.fits", and draw the lines between the points in red.

Example 3

chips> add_curve("lc.fits[cols time, count_rate, stat_err]");

Plot the time versus count_rate columns, and use the stat_err column as symmetric Y errors.

Example 4

chips> add_curve("lc.fits[cols time, count_rate,
stat_err]",{"line.color", "red", "err.color", "coral", "symbol.style",
"circle", "symbol.size", 6]);

Repeat the previous example, this time overriding several of the preference settings for curves.

Example 5

chips> dat = read_file("lc.fits[cols time, rate, error]");
chips> add_curve(dat);

Read in the time, rate, and error columns from a file using the Crates routine read_file, then plot the data.

Example 6

chips> x = [0:10];
chips> add_curve(x, x^2);

Plot the curve y = x^2 for the integer values 0 to 10.

Example 7

chips> z = [0:9];
chips> add_curve(z,z-4,{z*.2,z*.1});

Create a curve with assymetric Y error bars.

Example 8

chips> x = [0:10:0.1];
chips> set_preference("curve.symbol.style","none");
chips> add_curve(x,sin(x),{"line.color","plum"});
chips> add_curve(x,cos(x),{"line.color",0xf04539, "line.style", "dot"});

Set the symbol.style preference to "none" before adding the curves. Overplot the cosine curve on top of the sine curve, specifying attributes in a list.

Example 9

chips> in = read_file("data.fits");
chips> x = get_colvals(in, "X");
chips> y = get_colvals(in, "Y");
chips> add_curve(x, y);
chips> vals = ChipsCurve;
chips> vals.line.style = "none";
chips> vals.symbol.fill = 0;
chips> vals.symbol.size = 5;
chips> vals.symbol.color = "sienna";
chips> set_curve(vals);

Create a curve of the X and Y columns from data.fits. Populate the "vals" structure, then set the curve attributes.

Bugs

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

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.