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

Skip the navigation links
Last modified: 10 December 2007

URL: http://cxc.harvard.edu/chips4.0/gallery/histograms.py.html
Hardcopy (PDF): A4 | Letter

Gallery: Histograms (Python)

Examples


Displaying (x,y) data points as a histogram

[ChIPS output]
Postscript version
add_histogram("spectrum.fits[fit][cols x,y]")

Displaying (xlow,xhigh,y) data points as a histogram

[ChIPS output]
Postscript version
tbl = read_file("spectrum.fits[fit]")
xlo = get_colvals(tbl,"xlo")
xhi = get_colvals(tbl,"xhi")
y = get_colvals(tbl,"y")
add_histogram(xlo,xhi,y,["line.color","red"])
log_scale(X_AXIS)

A histogram which shows the bin edges

[ChIPS output]
Postscript version
tbl = read_file("histogram.fits")
xlo = get_colvals(tbl,"xlo")
xhi = get_colvals(tbl,"xhi")
y = get_colvals(tbl,"y")
add_histogram(xlo,xhi,y,["line.style","longdash","dropline",1])

A histogram showing the full range of options

[ChIPS output]
Postscript version
tbl = read_file("histogram.fits")
xlo = get_colvals(tbl,"xlo")
xhi = get_colvals(tbl,"xhi")
y = get_colvals(tbl,"y")
dylo = get_colvals(tbl,"dylo")
dyhi = get_colvals(tbl,"dyhi")
hist = ChipsHistogram()
hist.dropline = 1
hist.line.color = "red"
hist.symbol.style = "diamond"
hist.symbol.size = 4.0
hist.symbol.fill = 1
hist.symbol.color = "orange"
hist.err.color = "green"
hist.fill.visible = 1
hist.fill.opacity = "0.2"
hist.fill.color = "blue"
add_histogram(xlo,xhi,y,dylo,dyhi,hist)

# Move the histogram behind the axes so that the tick marks are not hidden
shuffle_back(chips_histogram)
Hardcopy (PDF): A4 | Letter
Last modified: 10 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.