# Basic imports
from physt.examples import normal_h2, normal_h1
from physt.plotting import plotly
import physt.plotting
import numpy as np
np.random.seed(42)
# Set that we want plotly
physt.plotting.set_default_backend("plotly")
# Define the 1-D example
H = normal_h1()
The default plot is bar
.
H.plot() # Same as H.plot.bar()
H.plot.line()
H.plot.scatter()
If you want to further manipulate the figures, you can return them from
the function as-is using the raw
keyword.
figure = H.plot.scatter(raw=True)
type(figure)
plotly.graph_objs._figure.Figure
H2 = normal_h2()
# Default is heatmap
H2.plot()
from physt import collection
collection = collection({
"small": np.random.normal(160, 20, 600),
"tall": np.random.normal(180, 20, 1000),
"huge": np.random.normal(200, 20, 400),
"gigantic": np.random.normal(220, 20, 200)
}, "human")
collection.plot.line()
# Let's see normalized histograms in the collection
collection.normalize_bins().plot(barmode="overlay", alpha=0.3)
# ...and how they look like when stacked
collection.normalize_bins().plot(barmode="stack")