Dist Plot#

See also

API Documentation: plot_dist()

../_images/mpl_plot_dist.png

import matplotlib.pyplot as plt
import numpy as np

import arviz as az

az.style.use("arviz-doc")

data_poisson = np.random.poisson(4, 1000)
data_gaussian = np.random.normal(0, 1, 1000)

fig, ax = plt.subplots(1, 2)
fig.suptitle("Distributions")

ax[0].set_title("Poisson")
az.plot_dist(data_poisson, color="C1", label="Poisson", ax=ax[0])

ax[1].set_title("Gaussian")
az.plot_dist(data_gaussian, color="C2", label="Gaussian", ax=ax[1])

plt.show()

import bokeh.plotting as bkp
import numpy as np
from bokeh.layouts import row

import arviz as az

a = np.random.poisson(4, 1000)
b = np.random.normal(0, 1, 1000)

figure_kwargs = dict(height=500, width=500, output_backend="webgl")
ax_poisson = bkp.figure(**figure_kwargs)
ax_normal = bkp.figure(**figure_kwargs)

az.plot_dist(a, color="black", label="Poisson", ax=ax_poisson, backend="bokeh", show=False)
az.plot_dist(b, color="red", label="Gaussian", ax=ax_normal, backend="bokeh", show=False)

ax = row(ax_poisson, ax_normal)

if az.rcParams["plot.bokeh.show"]:
    bkp.show(ax)