This page is for the obsolete Sherpa 4.16 release. Please see the Sherpa home page for the latest release.
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
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 (Figure 1).
Figure 1: Plotting multiple data sets
![[The two data sets are arranged vertically, showing counts/sec/kev (y axis) against energy (kev) for the x axis]](plot_multi.data.png)
![[Print media version: The two data sets are arranged vertically, showing counts/sec/kev (y axis) against energy (kev) for the x axis]](plot_multi.data.png)
Figure 1: Plotting multiple data sets
The default layout of the plots is not guaranteed to be free of overlaps of plot elements, such as the X-axis label of the top plot and the title of the second plot.
Parameters can be applied to all plots, such as setting the X-axis to a logarithmic scale:
sherpa> plot("data", 1, "data", 2, xlog=False)
You can display more than two plots, for instance (Figure 2):
sherpa> plot('fit', 1, 'fit', 2, 'delchi', 1, 'delchi', 2)
Figure 2: Plotting fit and residuals
![[The plots are in a two-by-two grid with the data and "sigma residuals" for the first dataset in the first column and for the second dataset in the second column]](plot_multi.all.png)
![[Print media version: The plots are in a two-by-two grid with the data and "sigma residuals" for the first dataset in the first column and for the second dataset in the second column]](plot_multi.all.png)
Figure 2: Plotting fit and residuals
The overlapping of labels is present and the Y axes of the plots are also not the same, which makes cross comparison difficult.
The spacing and layout of the plots can be adjusted using Matplotlib.