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

Skip the navigation links
Last modified: 20 May 2008
Hardcopy (PDF): A4 | Letter

How do I plot a histogram from a file?


The make_figure (S-Lang or Python help) and add_histogram (S-Lang or Python help) commands can plot data from a file (in both FITS binary and ASCII formats).

  1. Two columns: A set of (xmid,y) points.

    # Python
      make_figure("file.lis[cols x,y]","histogram")
      add_histogram("file.lis[cols x,y]")
    
    % S-Lang
      make_figure("file.lis[cols x,y]","histogram");
      add_histogram("file.lis[cols x,y]");
    

    This will plot up columns x and y from the file file.lis, and use x as the middle of each bin.

  2. Two columns: A set of ([xlo,xhi],y) points.

    # Python
      make_figure("file.fits[cols r,sur_bri]","histogram")
      add_histogram("file.fits[cols r,sur_bri]")
    
    % S-Lang
      make_figure("file.fits[cols r,sur_bri]","histogram");
      add_histogram("file.fits[cols r,sur_bri]");
    

    If the first column selected - here r - is a vector column with two values per row, then these two values will be used as the low and high bounds of each bin. An example of this case is when dmextract has been used to create a radial profile; the R column contains the inner and outer edges of each annulus and so can be used to define the histogram bins.



Hardcopy (PDF): A4 | Letter
Last modified: 20 May 2008


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.