def plot(self, overplot=False, clearwindow=True): default_color = self.histo_prefs['linecolor'] count = 0 for xlo, xhi, y, color in izip(self.xlo, self.xhi, self.y, self.colors): if count != 0: overplot=True self.histo_prefs['linecolor']=color Histogram.plot(self, xlo, xhi, y, title=self.title, xlabel=self.xlabel, ylabel=self.ylabel, overplot=overplot, clearwindow=clearwindow) count += 1 self.histo_prefs['linecolor'] = default_color
def plot(self, overplot=False, clearwindow=True): xlo = self.xlo xhi = self.xhi y = self.y if self.mask is not None: xlo = self.xlo[self.mask] xhi = self.xhi[self.mask] y = self.y[self.mask] Histogram.plot(self, xlo, xhi, y, title=self.title, xlabel=self.xlabel, ylabel=self.ylabel, overplot=overplot, clearwindow=clearwindow)
def plot(self, overplot=False, clearwindow=True, **kwargs): default_color = self.histo_prefs['linecolor'] count = 0 for xlo, xhi, y, color in \ zip(self.xlo, self.xhi, self.y, self.colors): if count != 0: overplot = True self.histo_prefs['linecolor'] = color # Note: the user settings are sent to each plot Histogram.plot(self, xlo, xhi, y, title=self.title, xlabel=self.xlabel, ylabel=self.ylabel, overplot=overplot, clearwindow=clearwindow, **kwargs) count += 1 self.histo_prefs['linecolor'] = default_color
edges = np.asarray([-10, -5, 5, 12, 17, 20, 30, 56, 60]) y = np.asarray([28, 62, 17, 4, 2, 4, 125, 55]) from sherpa.data import Data1DInt d = Data1DInt('example histogram', edges[:-1], edges[1:], y) from sherpa.plot import DataPlot dplot = DataPlot() dplot.prepare(d) dplot.plot() savefig('dataplot_histogram.png') from sherpa.plot import Histogram hplot = Histogram() hplot.overplot(d.xlo, d.xhi, d.y) savefig('dataplot_histogram_overplot.png') from sherpa.models.basic import Const1D, Gauss1D mdl = Const1D('base') - Gauss1D('line') mdl.pars[0].val = 10 mdl.pars[1].val = 25 mdl.pars[2].val = 22 mdl.pars[3].val = 10 report("mdl") from sherpa.plot import ModelPlot mplot = ModelPlot() mplot.prepare(d, mdl)