BaseDistribution.plot_sample (function)
def plot_sample(self, size=100000, unit=None, wrap_at=None, seed=None, samples=None, label=None, xlabel=None, show=False, **kwargs)
Plot both a sampled histogram from the distribution. Requires matplotlib to be installed.
See also:
- BaseDistribution.plot
- BaseDistribution.plot_pdf
- BaseDistribution.plot_cdf
- BaseDistribution.plot_gaussian
- BaseDistribution.plot_uncertainties
Arguments
size
(int, optional, default=1e5): number of points to sample for the histogram. See also BaseDistribution.sample. Will be ignored ifsamples
is provided.unit
(astropy.unit, optional, default=None): units to use along the x-axis. Astropy must be installed. Ifsamples
is provided, the passed values will be assumed to be in the correct units.wrap_at
(float, None, or False, optional, default=None): value to use for wrapping. See BaseDistribution.wrap. If not provided or None, will use the value from BaseDistribution.wrap_at. Note: wrapping is computed before changing units, sowrap_at
must be provided according to BaseDistribution.unit notunit
. Will be ignored ifsamples
is provided.seed
(int, optional): seed to use when sampling. See also BaseDistribution.sample. Will be ignored ifsamples
is provided.samples
(array, optional, default=None): plot specific sampled values instead of calling BaseDistribution.sample internally. Will overridesize
.label
(string, optional, default=None): override the label on the x-axis. If not provided or None, will use BaseDistribution.label. Will only be used ifshow=True
. Unit will automatically be appended. Will be ignored ifxlabel
is provided.xlabel
(string, optional, default=None): override the label on the x-axis without appending the unit. Will overridelabel
.show
(bool, optional, default=True): whether to show the resulting matplotlib figure.**kwargs
: all keyword arguments will be passed on to plt.hist. If not provided,bins
will default to the stored bins for Histogram distributions, otherwise will default to 25.
Returns
- the return from plt.hist
Raises
- ImportError: if matplotlib dependency is not met.