BaseUnivariateDistribution.plot (function)
def plot(self, size=100000.0, unit=None, wrap_at=None, seed=None, samples=None, plot_sample=True, plot_sample_kwargs={'color': 'gray'}, plot_pdf=True, plot_pdf_kwargs={'color': 'red'}, plot_cdf=False, plot_cdf_kwargs={'color': 'green'}, plot_gaussian=False, plot_gaussian_kwargs={'color': 'blue'}, plot_uncertainties=True, plot_uncertainties_kwargs={'color': 'black', 'linestyle': 'dashed'}, label=None, xlabel=None, show=False, **kwargs)
Plot both the analytic distribution function as well as a sampled histogram from the distribution. Requires matplotlib to be installed.
See also:
- BaseUnivariateDistribution.plot_sample
- BaseUnivariateDistribution.plot_pdf
- BaseUnivariateDistribution.plot_cdf
- BaseUnivariateDistribution.plot_gaussian
Arguments
size(int, optional, default=1e5): number of points to sample for the histogram. See also BaseUnivariateDistribution.sample. Will be ignored ifsamplesis provided.unit(astropy.unit, optional, default=None): units to use along the x-axis. Astropy must be installed. Ifsamplesis 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 BaseUnivariateDistribution.wrap. If not provided or None, will use the value from BaseUnivariateDistribution.wrap_at. Note: wrapping is computed before changing units, sowrap_atmust be provided according to BaseUnivariateDistribution.unit notunit. Will be ignored ifsamplesis provided.seed(int, optional): seed to use when sampling. See also BaseUnivariateDistribution.sample. Will be ignored ifsamplesis provided.samples(array, optional, default=None): plot specific sampled values instead of calling BaseUnivariateDistribution.sample internally. Will overridesize.plot_sample(bool, optional, default=True): whether to plot the histogram from sampling. See also BaseUnivariateDistribution.plot_sample.plot_sample_kwargs(dict, optional, default={'color': 'gray'}): keyword arguments to send to BaseUnivariateDistribution.plot_sample.plot_pdf(bool, optional, default=True): whether to plot the analytic form of the underlying distribution, if applicable. See also BaseUnivariateDistribution.plot_pdf.plot_pdf_kwargs(dict, optional, default={'color': 'red'}): keyword arguments to send to BaseUnivariateDistribution.plot_pdf.plot_cdf(bool, optional, default=True): whether to plot the analytic form of the cdf, if applicable. See also BaseUnivariateDistribution.plot_cdf.plot_cdf_kwargs(dict, optional, default={'color': 'green'}): keyword arguments to send to BaseUnivariateDistribution.plot_cdf.plot_gaussian(bool, optional, default=False): whether to plot a guassian distribution fit to the sample. Only supported for distributions that have BaseUnivariateDistribution.to_gaussian methods.plot_gaussian_kwargs(dict, optional, default={'color': 'blue'}): keyword arguments to send to BaseUnivariateDistribution.plot_gaussian.plot_uncertainties(bool or int, optional, default=True): whether to plot uncertainties (as vertical lines) and include the representation of the uncertainties in the plot title. If an integer, will plot at thatsigma. If True, will default tosigma=1. See BaseUnivariateDistribution.uncertainties.plot_uncertainties_kwargs(dict, optional, default={'color': 'black', 'linestyle': 'dashed'}): keyword arguments to send to BaseUnivariateDistribution.plot_uncertainties.label(string, optional, default=None): override the label on the x-axis. If not provided or None, will use BaseUnivariateDistribution.label. Will only be used ifshow=True. Unit will automatically be appended. Will be ignored ifxlabelis 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 (except forbins) will be passed on to BaseUnivariateDistribution.plot_pdf and BaseUnivariateDistribution.plot_gaussian and all keyword arguments will be passed on to BaseUnivariateDistribution.plot_sample. Keyword arguments defined inplot_sample_kwargs,plot_pdf_kwargs, andplot_gaussian_kwargswill override the values sent inkwargs.
Returns
- tuple: the return values from BaseUnivariateDistribution.plot_sample (or None if
plot_sample=False), BaseUnivariateDistribution.plot_pdf (or None ifplot_pdf=False), BaseUnivariateDistribution.plot_cdf (or None ifplot_cdf=False), Gaussian.plot_pdf (or None ifplot_gaussian=False), and BaseUnivariateDistribution.plot_uncertainties (or None ifplot_uncertainties=False).
Raises
- ImportError: if matplotlib dependency is not met.