In [1]:
import numpy as np
np.random.seed(42)
from physt import h1
from physt.histogram_collection import HistogramCollection
In [2]:
from physt.plotting import matplotlib
In [3]:
from physt.plotting import set_default_backend
from physt.plotting import vega
from physt.plotting import matplotlib
set_default_backend("matplotlib")
In [4]:
%matplotlib inline
In [5]:
data1 = np.random.normal(100, 15, 2000)
h_a = h1(data1, "fixed_width", 10, name="first")
h_a.plot();
In [6]:
data2 = np.random.normal(80, 10, 2000)
h_b = h1(data2, h_a.binning, name="second")
h_b.plot();
In [7]:
collection = HistogramCollection(h_a, h_b, title="Combination")
In [8]:
collection.create("third", np.random.normal(148, 5, 300))
Out[8]:
In [9]:
# The default
collection.plot();
In [10]:
# Add some options
collection.plot.line(alpha=.5, lw=8, xlabel="Index");
In [11]:
set_default_backend("vega")
In [12]:
collection.plot.scatter(legend=False)
In [13]:
collection.plot.line(lw=7, legend=True, alpha=.5)