def plot_power_histogram(self, ax=None, load_kwargs=None, plot_kwargs=None, range=None, **hist_kwargs): """ Parameters ---------- ax : axes load_kwargs : dict plot_kwargs : dict range : None or tuple if range=(None, x) then on_power_threshold will be used as minimum. **hist_kwargs Returns ------- ax """ if ax is None: ax = plt.gca() if load_kwargs is None: load_kwargs = {} if plot_kwargs is None: plot_kwargs = {} generator = self.power_series(**load_kwargs) # set range if range is None or range[0] is None: maximum = None if range is None else range[1] range = (self.on_power_threshold(), maximum) hist, bins = histogram_from_generator(generator, range=range, **hist_kwargs) # Plot plot_kwargs.setdefault('linewidth', 0.1) ax.fill_between(bins[:-1], 0, hist, **plot_kwargs) first_bin_width = bins[1] - bins[0] ax.set_xlim([bins[0] - (first_bin_width / 2), bins[-1]]) ax.set_xlabel('Power (watts)') ax.set_ylabel('Count') return ax
def plot_power_histogram(self, ax=None, load_kwargs=None, plot_kwargs=None, range=None, **hist_kwargs): """ Parameters ---------- ax : axes load_kwargs : dict plot_kwargs : dict range : None or tuple if range=(None, x) then on_power_threshold will be used as minimum. **hist_kwargs Returns ------- ax """ if ax is None: ax = plt.gca() if load_kwargs is None: load_kwargs = {} if plot_kwargs is None: plot_kwargs = {} generator = self.power_series(**load_kwargs) # set range if range is None or range[0] is None: maximum = None if range is None else range[1] range = (self.on_power_threshold(), maximum) hist, bins = histogram_from_generator(generator, range=range, **hist_kwargs) # Plot plot_kwargs.setdefault('linewidth', 0.1) ax.fill_between(bins[:-1], 0, hist, **plot_kwargs) first_bin_width = bins[1] - bins[0] ax.set_xlim([bins[0]-(first_bin_width/2), bins[-1]]) ax.set_xlabel('Power (watts)') ax.set_ylabel('Count') return ax