Skip to content

Plotting#

You can select the prefix to source the x, y values to plot.

Example of plotting

from scipy.stats import cosine

from cumulative.datasets.load_dist import load_dist
from cumulative.plotting import plot_ctx

c = load_dist([cosine] * 100, kind="rvs")

print("Dataset overview:")
c.describe()

with plot_ctx() as ax:
    c.plot.draw(ax=ax, style="-", color="blue", alpha=0.1)
Output
Dataset overview:
Count...: 100
Length..: min=100 max=100 diff=0
X min...: min=0.0 max=0.0 diff=0.0
X max...: min=1.0 max=1.0 diff=0.0
Y min...: min=-3.0250691220095214 max=-1.8539150191093852 diff=1.1711541029001362
Y max...: min=1.8804498071939255 max=2.990917108965477 diff=1.1104673017715516

Example of plotting

from scipy.stats import norm

from cumulative.datasets.load_dist import load_dist
from cumulative.plotting import plot_ctx

with plot_ctx() as ax:
    load_dist([norm(0, 1)] * 30, kind="rvs").plot.draw(
        ax=ax, style="-", color="green", alpha=0.5
    )
    load_dist([norm(0, 2)] * 30, kind="rvs").plot.draw(
        ax=ax, style="-", color="blue", alpha=0.5
    )
    load_dist([norm(0, 3)] * 30, kind="rvs").plot.draw(
        ax=ax, style="-", color="red", alpha=0.5
    )
Output
[image]