Chandra X-Ray Observatory
Skip to the navigation links
Last modified: 13 March 2017

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 and plot_fit_delchi 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 to specify which plot to edit (as indicated by the info command), and then commands like set_curve and set_axis to make the desired edits.


sherpa> plot_fit_delchi()   

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):

sherpa> current_plot("plot1")  
sherpa> set_plot_ylabel("counts s^{-1} keV^{-1}")   

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.

sherpa> current_plot("plot2")  
sherpa> set_curve(["symbol.size",5])  
sherpa> set_curve(["symbol.color","blue"])  
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 by the Sherpa plot command:

sherpa> log_scale(X_AXIS) 
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". For more on multiple plots, see the ChIPS thread "ChIPS - creating and using multiple plots".

Last modified: 13 March 2017
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.