Plotting physt histogramsΒΆ

Some plotting examples, with no exhaustive documentation.

[1]:
# Necessary import evil
import physt
from physt import h1, h2, histogramdd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

np.random.seed(42)

from physt import plotting
[2]:
# Some data
x = np.random.normal(100, 1, 10000)
y = np.random.normal(10, 10, 10000)
[3]:
ax = h2(x, y, 15).plot(figsize=(6, 6), show_zero=False, alpha=0, text_color="black", show_values=True, cmap="BuGn_r", show_colorbar=False, transform=lambda x:1)
h2(x, y, 50).plot.image(cmap="Spectral_r", alpha=0.75, ax=ax)
[3]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f88f8266f28>
_images/plotting_3_1.png
[4]:
h2(x, y, 40, name="Gauss").plot("image", cmap="rainbow", figsize=(5, 5))
[4]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f88f6dd1b38>
_images/plotting_4_1.png
[5]:
plotting.matplotlib.bar3d(h2(x, y, 10, name="Gauss"), figsize=(5, 5), cmap="Accent");
_images/plotting_5_0.png
[6]:
h1(x, "human", 10, name="Gauss").plot(ylim=(100, 1020), cmap="Greys", ticks="edge", errors=True);
_images/plotting_6_0.png
[7]:
h1(x, "human", 200, name="Gauss").plot.line(errors=True, yscale="log")
[7]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f88f5e8a9e8>
_images/plotting_7_1.png
[8]:
h1(x, "human", 200, name="Gauss").plot.fill(lw=1, alpha=.4, figsize=(8, 4))
h1(x, "human", 200, name="Gauss").plot.fill(lw=1, alpha=.4, yscale="log", figsize=(8, 4), color="red")
[8]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f88f5c3ef28>
_images/plotting_8_1.png
_images/plotting_8_2.png
[9]:
h1(x, "human", 200, name="Gauss").plot.scatter(errors=True, xlim=(90, 100), show_stats=True)
[9]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f88f5b386a0>
_images/plotting_9_1.png
[10]:
#h = h1(x, "human", 200, name="Gauss")
#ax = h.plot("scatter", cumulative=True, s=3, transform=lambda x: np.sin(x / 500), cmap="rainbow")
# h.plot.line(ax=ax, cumulative=True)
[11]:
ha = h1(x, "human", 20, name="Left")
hb = h1(x + 1 * np.sin(x / 12), "human", 40, name="Right")

from physt.plotting.matplotlib import pair_bars
[12]:
pair_bars(ha, hb, density=True, errors=True, figsize=(5, 5));
/home/honza/code/my/physt-0.3/physt/histogram_base.py:854: FutureWarning:

Conversion of the second argument of issubdtype from `int` to `np.signedinteger` is deprecated. In future, it will be treated as `np.int64 == np.dtype(int).type`.

/home/honza/code/my/physt-0.3/physt/histogram_base.py:854: FutureWarning:

Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.

_images/plotting_12_1.png
[ ]:

[ ]:

[ ]: