WARNING: Experimental functionality that will probably be redesigned in version 0.6.
import numpy as np
np.random.seed(42)
from physt import h1
from physt.types import HistogramCollection
from physt.plotting import matplotlib
from physt.plotting import set_default_backend
from physt.plotting import vega
from physt.plotting import matplotlib
set_default_backend("matplotlib")
data1 = np.random.normal(100, 15, 2000)
h_a = h1(data1, "fixed_width", bin_width=10, name="first")
h_a.plot();
data2 = np.random.normal(80, 10, 2000)
h_b = h1(data2, h_a.binning, name="second")
h_b.plot();
collection = HistogramCollection(h_a, h_b, title="Combination")
collection.create("third", np.random.normal(148, 5, 300))
Histogram1D('third', bins=(11,), total=299, dtype=int64)
# The default
collection.plot();
# Add some options
collection.plot.line(alpha=.5, lw=8, xlabel="Index");
set_default_backend("vega")
collection.plot.scatter(legend=False)
collection.plot.line(lw=7, legend=True, alpha=.5)