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

How can I create multiple plots in the same window?


In the following we assume you have two data sets loaded with ids of 1 (i.e. the default) and 2, that you have done the following

sherpa> get_data_plot_prefs()["xlog"] = True
sherpa> get_data_plot_prefs()["ylog"] = True

and that fits have been made to both data sets.

If you wish to display multiple datasets in the same plot window then you can use the plot command; for example if you have two datasets with ids of 1 and 2 then:

sherpa> plot("data", 1, "data", 2)

will display each data set in a separate plot in the same window.

[There are two plots arranged vertically]

You can display more than two plots, for instance:

sherpa> plot("fit", 1, "fit", 2, "delchi", 1, "delchi", 2)
sherpa> current_plot("plot3")
sherpa> log_scale(X_AXIS)
sherpa> current_plot("plot4")
sherpa> log_scale(X_AXIS)

where the extra commands are to ensure that the residual plots match the axis scaling used for the data and model.

[There are four plots, in a two by two grid: the columns are for the different datasets, with the fit above the residuals]

We can use more ChIPS commands to modify the visualization, e.g. to remove the gaps between the plots, remove axis labels, and ensure the x/y axes match between rows/columns:

sherpa> adjust_grid_gaps(0,0)
sherpa> bind_axes("plot1", "ax1", "plot3", "ax1")
sherpa> bind_axes("plot2", "ax1", "plot4", "ax1")
sherpa> bind_axes("plot3", "ay1", "plot4", "ay1")
sherpa> bind_axes("plot1", "ay1", "plot2", "ay1")
sherpa> current_plot("plot1")
sherpa> limits(Y_AXIS, AUTO, AUTO)
sherpa> hide_axis("ax1")
sherpa> current_plot("plot2")
sherpa> hide_axis("ax1")
sherpa> hide_axis("ay1")
sherpa> current_plot("plot3")
sherpa> set_plot_title("")
sherpa> current_plot("plot4")
sherpa> hide_axis("ay1")
sherpa> set_plot_title("")
[The X and Y axes match between columns and rows, there is no gap between the plots, and overlapping text has been removed]


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:   cxchelp@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2017. All rights reserved.