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

Synopsis

Creates a histogram-style figure.

Syntax

add_histogram([ChipsId,] filename [,attributes]);
add_histogram([ChipsId,] TABLECrate [,attributes]);
add_histogram([ChipsId,] counts [,attributes]);
add_histogram([ChipsId,] bins, counts [,attributes]);
add_histogram([ChipsId,] bin_low, bin_high, counts [,attributes]);
add_histogram([ChipsId,] bin_low, bin_high, counts, yerrs
[,attributes]);
add_histogram([ChipsId,] bin_low, bin_high, counts, ydown, yup,
[,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")
  • counts - an array of values containing the sum of counts for each bin
  • bin_low - array of values indicating the low value of the bin delimiter range. The number of values in the array must equal the number of values in the counts array.
  • bin_high - array of values indicating the high value of the bin delimiter range. The number of values in the array must equal the number of values in the counts array.
  • error_down - array of error down values for each bin. The number of values in the array must equal the number of values in the counts array.
  • error_up - array of error up values for each bin. The number of values in the array must equal the number of values in the counts array.
  • attributes - optional parameters which allow the user to configure window properties though a structure, list, or attribute string.

The add_histogram command creates a histogram-style figure whose attributes are specified by user preferences or in an attribute list. The new histogram becomes current by default; providing a ChipsId overrides the currency state.

If bin_low or bin_high column is set to "NULL", then the column that is provided is used as the midpoint of the bin.

Note that this command does not do any scientific calculations; it takes the input data as given and creates the figure.

Customizing the Histogram

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

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

The attributes associated with histograms are:

Attribute Description Options Default
depth Value indicating the depth of the plot title see the Depth section of "ahelp sl.chips chipsopt" 100
dropline Boolean indicating whether vertical lines delineating each histogram bin should be drawn to the X axis on|off on
err.color Color of the curve err bars see the Color section of "ahelp sl.chips chipsopt" default: white in the ChIPS window, black on printout
err.down Histogram y down errors if data provided true/false true
err.style Specifies the error bar style "bar"|"cap" "bar"
err.thickness Specifies the thickness of error bars see the Thickness section of "ahelp sl.chips chipsopt" 1
err.up Histogram y up errors if data provided true/false true
fill.color Color of the histogram fill, if visible see the Color section of "ahelp sl.chips chipsopt" default
fill.opacity Opacity of the histogram fill, if visible 0.0:1.0 1.0
fill.visible Should the histogram be filled or not false|true; see the Booleans section of "ahelp sl.chips chipsopt" false
line.color Color of the curve line see the Color section of "ahelp sl.chips chipsopt" default: white in the ChIPS window, black on printout
line.style The pattern used for the histogram line style see the Line Style section of "ahelp sl.chips chipsopt" chips_solid
line.thickness Thickness of the histogram line see the Thickness section of "ahelp sl.chips chipsopt" 1
stem stem used for histogram id alphanumeric hst
symbol.angle The angle of rotation for the histogram symbols -360.0:360.0 0.0
symbol.color Color of the histogram symbols see the Color section of "ahelp sl.chips chipsopt" default: white in the ChIPS window, black on printout
symbol.fill Should the histogram symbols be filled or not true/false false
symbol.size Size of the curve symbols 1:100 5
symbol.style The shape of the glyph used as the histogram symbols see the Symbol Styles section of "ahelp sl.chips chipsopt" chips_none

Example 1

chips> add_histogram("peak.fits[cols energy,counts]");

Create a histogram from energy and counts columns in the file "peak.fits".

Example 2

chips> dat = read_file("peak.fits[cols energy,counts]");
chips> add_histogram(dat);

Create a histogram from energy and counts columns in the file "peak.fits" via CRATES.

Example 3

chips> add_histogram([10,12,15]);

A simple add_histogram command, using the default attribute values. This command will divide the x-axis into three equally sized bins; the number of bins is the same as the number of elements in the counts array. The range of the x axis is also equal to the number of bins in the counts array. The center of the x bin ranges are equal to the integer number of bins (i.e. 1.0, 2.0, and 3.0). The Y axis is scaled to the min and max of the counts range array values.

Example 4

chips> add_histogram([1,5,9], [10, 15, 20],{"dropline", "on"});

Create three bins of counts of 10, 15 and 20 centered at 1, 5, and 9. The value of dropline is "on", and adjacent bins share borders, so all bin borders are rendered.

Example 5

chips> add_histogram([10, 15, 20], [12, 17, 22], [5,8,13]);

Create three bins of counts of 5, 8 and 13. As both the bin_low and bin_high arrays have been given, they are used to specify the actual bin bounds instead of centers.

Example 6

chips> add_histogram([10, 15, 20], [12, 17, 22], [5,8,13], [1,1,2]);
chips> set_histogram({"symbol.style", "diamond", "err.style",
"capped"});

The previous example is repeated, but symmetric error bars of lengths 1, 1, and 2 have been added. The error style is "bar", and the error bar is centered on the bin.

Example 7

chips> add_histogram([10, 15, 20], [12, 17, 22], [5,8,13], [1,1,2],
[2,4,4]);
chips> set_histogram({"symbol.style", "cross", "err.style", "capped"});

The previous example is repeated, but with asymmetric error bars (low values of 1,1,2 and high values of 2,4,4).

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.