/ sherpa4.16 / faq / plot_overlay_mpl.html
Including extra data in plots with matplotlib
Once a plot has been created then Matplotlib commands can be used to augment the display. For example, adding labels to identify the different components:
sherpa> plot_fit(ylog=False) sherpa> plot_resid(overplot=True, marker='s', markersize=3, alpha=0.5) sherpa> ax = plt.hca() sherpa> kwargs = {'horizontalalignment': 'right', 'transform': ax.transAxes} sherpa> plt.text(0.9, 0.9, 'Data', color='blue', **kwargs) sherpa> plt.text(0.9, 0.8, 'Residuals', color='green', **kwargs)
Overplotting residuals
You can even combine data with different axes; for example in the following we add a second Y axis to the top plot to show how the ARF varies with energy:
sherpa> plot_fit_ratio(1) sherpa> plt.xlim(0.4, 8) sherpa> fig = plt.gcf() sherpa> plt.sca(fig.axes[0]) sherpa> ax2 = plt.twinx() sherpa> plot_arf(1, overplot=True, color='gray', linestyle='dotted')
Overplotting the ARF
/ sherpa4.16 / faq / plot_overlay_mpl.html