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=-2.9962408599264885 max=-1.919100983488837 diff=1.0771398764376514
Y max...: min=1.9554314698259307 max=3.0411291627601527 diff=1.085697692934222

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]