Last modified: December 2013

URL: https://cxc.cfa.harvard.edu/chips/ahelp/get_histogram.html
AHELP for CIAO 4.11 ChIPS v1

get_histogram

Context: histograms

Synopsis

Retrieves the attribute value(s) of the histogram.

Syntax

get_histogram()
get_histogram(id)
get_histogram(id, attribute)

Description

The function arguments.

Argument Description
id A ChipsId structure identifying the item, or a string containing the name of the object.
attribute The name of the attribute to retrieve, such as 'line.color' or 'fill.color'.

The get_histogram command returns a structure containing all the attribute values of the histogram. To retrieve the value of a specific attribute, provide the attribute name and the id or ChipsId of the object.

Some values are set to "None" in the returned structure. These entries generally correspond to attributes which may only be modified at creation time, such as the object id.

Please see the "Histogram Preferences and Attributes" section below the examples for a list of the histogram preferences.

Data Range

The get_histogram_range command returns the X and Y ranges of the current axes of the current plot. The values are returned as [xmin, xmax, ymin, ymax]. There are also individual commands for retrieving just the x or y range: get_histogram_xrange and get_histogram_yrange.

To see if a histogram is hidden or visible, use the get_histogram_visible command.

Advanced Functions

The module of advanced ChIPS functions contains other commands for retrieving attribute values (refer to "ahelp chips" for information on loading the module):

get_histogram_depth
get_histogram_dropline
get_histogram_errcolor
get_histogram_errdown
get_histogram_errstyle
get_histogram_errthickness
get_histogram_errup
get_histogram_fill
get_histogram_fillcolor
get_histogram_fillopacity
get_histogram_linecolor
get_histogram_linestyle
get_histogram_linethickness
get_histogram_symbolangle
get_histogram_symbolcolor
get_histogram_symbolfill
get_histogram_symbolsize
get_histogram_symbolstyle

Examples

Example 1

chips> add_histogram("peak.fits[cols energy,counts]")
chips> print(get_histogram())
chips> print(get_histogram("hist1","fill.color"))

A histogram is created and becomes current. Calling get_histogram with no argument returns all the attributes of the object. get_histogram is called a second time to return just the "fill.color" attribute.

Example 2

chips> add_histogram("peak.fits[cols energy,counts]")
chips> add_histogram([10,12,15])
chips> print(get_histogram("hist1"))

Two histograms are created. get_histogram is called with the id of the first histogram, returning all attributes.

Example 3

chips> id=ChipsId()
chips> id.histogram="hist1"
chips> print(get_histogram(id))

A ChipsId structure is created and the id.histogram field is set to "hist1". get_histogram is called with the ChipsId.

Example 4

chips> hi = get_histogram()
chips> print(hi)

Retrieve a structure containing the attribute values of the current histogram and store the results in "hi". Print the contents of "hi".


Histogram Preferences and Attributes

The attributes associated with histograms are given in the following table, where the "Set?" column refers to whether the attribute can be changed using the set_histogram() command. To change the histogram preference settings prepend "histogram." to the attribute name.

Attribute Description Options Default Set?
depth Value indicating the depth of the plot title see the Depth section of "ahelp chipsopt" default Yes
dropline Boolean indicating whether bin edges are extended to 0 for connected bins on|off on Yes
err.caplength Length of the cap drawn on error bars (when err.style is cap). 1 to 100, inclusive. 10 Yes
err.color Color of the curve err bars name or hex; see the Color section of "ahelp chipsopt" default Yes
err.down Histogram y down errors if data provided see the Booleans section of "ahelp chipsopt" true Yes
err.style Specifies the error bar style bar or cap bar Yes
err.thickness Specifies the thickness of error bars 0.5 to 10.0; see the Thickness section of "ahelp chipsopt" 1 Yes
err.up Histogram y up errors if data provided see the Booleans section of "ahelp chipsopt" true Yes
fill.color Color of the histogram fill name or hex; see the Color section of "ahelp chipsopt" default Yes
fill.opacity Opacity of the histogram fill 0.0 to 1.0, inclusive, where 0 is fully transparent and 1 is fully opaque 1.0 Yes
fill.style The fill style for the histogram see the Fill Pattern section of "ahelp chipsopt" 0 (no fill) Yes
line.color Color of the curve line name or hex; see the Color section of "ahelp chipsopt" default Yes
line.style The pattern used for the histogram line style see the Line Style section of "ahelp chipsopt" chips_solid Yes
line.thickness Thickness of the histogram line 0.5 to 10.0; see the Thickness section of "ahelp chipsopt" 1 Yes
stem stem used for histogram id An alpha-numeric character sequence that does not contain a space hst No
symbol.angle The angle, in degrees, of rotation for the histogram symbols -360.0 to 360.0 0.0 Yes
symbol.color Color of the histogram symbols name or hex; see the Color section of "ahelp chipsopt" default Yes
symbol.fill Should the histogram symbols be filled or not see the Booleans section of "ahelp chipsopt" false Yes
symbol.size Size of the curve symbols 1 to 100 5 Yes
symbol.style The shape of the glyph used as the histogram symbols see the Symbol Styles section of "ahelp chipsopt" chips_none Yes

Bugs

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

See Also

concepts
setget
histograms
add_histogram, current_histogram, delete_histogram, display_histogram, hide_histogram, set_histogram, shuffle_histogram
utilities
load_fill, set_current