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

Skip the navigation links
Last modified: 18 June 2009

How can I modify a single plot in a display containing multiple plots?


Plotting in Sherpa is done with ChIPS, therefore ChIPS commands are issued from within a Sherpa session to modify plots.

plot_fit_resid (S-Lang or Python help) and plot_fit_delchi (S-Lang or Python help) are examples of Sherpa commands which produce ChIPS multi-plots. To make changes to each plot individually, you can use the ChIPS command current_plot (S-Lang or Python help) to specify which plot to edit (as indicated by the info (S-Lang or Python help) command), and then commands like set_curve (S-Lang or Python help) and set_axis (S-Lang or Python help) to make the desired edits.

Example:

#S-Lang
sherpa> plot_fit_delchi();
#Python
sherpa> plot_fit_delchi()   

#S-Lang
sherpa> info();
#Python         
sherpa> info()                    

Window [win1]
  Frame [frm4]
    Plot [plot1]   (0.15,0.40)  .. (0.90,0.90)
      Border bottom [bx1]  top [bx2]  left [by1]  right [by2]
      X Axis [ax1]
      Y Axis [ay1]
      Curve [crv1]
      Curve [crv2]
    Plot [plot2]   (0.15,0.15)  .. (0.90,0.40)
      Border bottom [bx1]  top [bx2]  left [by1]  right [by2]
      X Axis [ax1]
      Y Axis [ay1]
      Curve [crv1]
      Line [line1]

The info command returns information about the objects defining the plots created, including ID names for the object attributes. There is one ChIPS window called "win1", two plots called "plot1" and "plot2" with curves "crv1", "crv2", etc.

We wish to change the labels of the top plot, so we need to make it the current plot before changing the values (if current_plot had not been called, the changes would have been made to the residual plot, as it was the last plot created):

#S-Lang
sherpa> current_plot("plot1");  
#Python
sherpa> current_plot("plot1")  

#S-Lang
sherpa> set_plot_ylabel("counts s^{-1} keV^{-1}");   
#Python                          
sherpa> set_plot_ylabel("counts s^{-1} keV^{-1}")   

#S-Lang
sherpa> set_axis({"label.size",20});
#Python
sherpa> set_axis(["label.size",20])                   

Next, we make the residual plot current and use set_curve to change the symbol size to 5, and the color of the symbols and error bars to blue.

#S-Lang
sherpa> current_plot("plot2"); 
#Python
sherpa> current_plot("plot2")  

#S-Lang                         
sherpa> set_curve({"symbol.size",5});  
#Python                          
sherpa> set_curve(["symbol.size",5])  

#S-Lang                    
sherpa> set_curve({"symbol.color","blue"});  
#Python                    
sherpa> set_curve(["symbol.color","blue"])  

#S-Lang           
sherpa> set_curve({"err.color","blue"});  
#Python             
sherpa> set_curve(["err.color","blue"])                

We now change the X-axis scaling and range (this changes the X axis in both plots because the axes are bound together (S-Lang or Python help) by the Sherpa plot command:

#S-Lang
sherpa> log_scale(X_AXIS);
#Python
sherpa> log_scale(X_AXIS) 

#S-Lang                          
sherpa> limits(X_AXIS,0.2,7); 
#Python                           
sherpa> limits(X_AXIS,0.2,7)                           
[Plot of model fit to data and delta-chi residuals]

To learn more about the most commonly used ChIPS plotting features in Sherpa, see the thread "Plotting in Sherpa Using Common Options" (S-Lang or Python). For more on multiple plots, see the ChIPS thread "ChIPS - creating and using multiple plots" (S-Lang or Python).



Last modified: 18 June 2009


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.