drippy.univariate
Plotting functions for univariate models (y = c + e).
Attributes
Functions
|
Creates a run sequence plot of y vs index or continuous index t. |
|
Creates a lag plot of the data. |
|
Creates a histogram of the data. |
Creates a normal probability plot. |
|
|
Creates a 4-plot (run sequence, lag, histogram, normal probability). |
|
Creates a PPCC plot (rough + fine) for distribution shape estimation. |
|
Creates a Weibull probability plot. |
|
Creates a probability plot for a specified distribution. |
Creates a Box-Cox normality plot (2x2 grid). |
|
|
Creates a bootstrap distribution plot. |
|
Creates a Box-Cox linearity plot. |
Module Contents
- drippy.univariate.run_sequence_plot(data: drippy.data.EDAData, fig: matplotlib.figure.Figure | None = None, ax: matplotlib.axes.Axes | None = None) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes][source]
Creates a run sequence plot of y vs index or continuous index t.
- Parameters:
data – EDAData container. Uses t as x-axis if present, else index.
fig – Matplotlib figure. If None, creates new figure.
ax – Matplotlib axes. If None, creates new axes.
- Returns:
The figure and axes containing the plot.
- drippy.univariate.lag_plot(data: drippy.data.EDAData, fig: matplotlib.figure.Figure | None = None, ax: matplotlib.axes.Axes | None = None, lag: int = 1) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes][source]
Creates a lag plot of the data.
- Parameters:
data – EDAData container. Requires y.
fig – Matplotlib figure. If None, creates new figure.
ax – Matplotlib axes. If None, creates new axes.
lag – Number of lags. Must be positive and less than len(y).
- Returns:
The figure and axes containing the plot.
- drippy.univariate.histogram(data: drippy.data.EDAData, fig: matplotlib.figure.Figure | None = None, ax: matplotlib.axes.Axes | None = None, bins: int | str = 'auto') tuple[matplotlib.figure.Figure, matplotlib.axes.Axes][source]
Creates a histogram of the data.
- Parameters:
data – EDAData container. Requires y.
fig – Matplotlib figure. If None, creates new figure.
ax – Matplotlib axes. If None, creates new axes.
bins – Number of bins or bin strategy.
- Returns:
The figure and axes containing the plot.
- drippy.univariate.normal_probability_plot(data: drippy.data.EDAData, fig: matplotlib.figure.Figure | None = None, ax: matplotlib.axes.Axes | None = None, *, return_rsquared: bool = False) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes, float | None][source]
Creates a normal probability plot.
- Parameters:
data – EDAData container. Requires y.
fig – Matplotlib figure. If None, creates new figure.
ax – Matplotlib axes. If None, creates new axes.
return_rsquared – If True, includes R-squared as the third element.
- Returns:
(fig, ax, r_squared) where r_squared is None if return_rsquared is False.
- drippy.univariate.four_plot(data: drippy.data.EDAData, fig: matplotlib.figure.Figure | None = None, axes: numpy.ndarray | None = None) tuple[matplotlib.figure.Figure, numpy.ndarray][source]
Creates a 4-plot (run sequence, lag, histogram, normal probability).
- Parameters:
data – EDAData container. Requires y.
fig – Matplotlib figure. If None, creates new figure.
axes – ndarray of Axes with shape (2, 2). If None, creates new axes.
- Returns:
(fig, axes_flat) where axes_flat has shape (4,).
- drippy.univariate.ppcc_plot(data: drippy.data.EDAData, fig: matplotlib.figure.Figure | None = None, ax: numpy.ndarray | None = None, rough_range: tuple[float, float] = (-2, 2), n_rough: int = 50, n_fine: int = 100) tuple[matplotlib.figure.Figure, numpy.ndarray][source]
Creates a PPCC plot (rough + fine) for distribution shape estimation.
- Parameters:
data – EDAData container. Requires y.
fig – Matplotlib figure. If None, creates new figure.
ax – ndarray of Axes with shape (2,). If None, creates new axes.
rough_range – (min, max) range for rough search.
n_rough – Points in rough plot.
n_fine – Points in fine plot.
- Returns:
(fig, axes) where axes has shape (2,).
- drippy.univariate.weibull_plot(data: drippy.data.EDAData, fig: matplotlib.figure.Figure | None = None, ax: matplotlib.axes.Axes | None = None) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes][source]
Creates a Weibull probability plot.
- Parameters:
data – EDAData container. Requires y > 0.
fig – Matplotlib figure. If None, creates new figure.
ax – Matplotlib axes. If None, creates new axes.
- Returns:
The figure and axes containing the plot.
- drippy.univariate.probability_plot(data: drippy.data.EDAData, fig: matplotlib.figure.Figure | None = None, ax: matplotlib.axes.Axes | None = None, distribution: str = 'norm') tuple[matplotlib.figure.Figure, matplotlib.axes.Axes][source]
Creates a probability plot for a specified distribution.
- Parameters:
data – EDAData container. Requires y.
fig – Matplotlib figure. If None, creates new figure.
ax – Matplotlib axes. If None, creates new axes.
distribution – scipy.stats distribution name.
- Returns:
The figure and axes containing the plot.
- drippy.univariate.box_cox_normality_plot(data: drippy.data.EDAData, fig: matplotlib.figure.Figure | None = None, axes: numpy.ndarray | None = None) tuple[matplotlib.figure.Figure, numpy.ndarray][source]
Creates a Box-Cox normality plot (2x2 grid).
Shows: original histogram, Box-Cox normality curve, transformed histogram, normal probability plot of transformed data.
- Parameters:
data – EDAData container. Requires y > 0.
fig – Matplotlib figure. If None, creates new figure.
axes – ndarray of Axes with shape (2, 2). If None, creates new.
- Returns:
(fig, axes) where axes has shape (2, 2).
- drippy.univariate.bootstrap_plot(data: drippy.data.EDAData, fig: matplotlib.figure.Figure | None = None, ax: matplotlib.axes.Axes | None = None, statistic: collections.abc.Callable = np.mean, n_bootstrap: int = 10000) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes][source]
Creates a bootstrap distribution plot.
- Parameters:
data – EDAData container. Requires y.
fig – Matplotlib figure. If None, creates new figure.
ax – Matplotlib axes. If None, creates new axes.
statistic – Callable to bootstrap. Must be callable.
n_bootstrap – Number of bootstrap resamples.
- Returns:
The figure and axes containing the plot.
- drippy.univariate.box_cox_linearity_plot(data: drippy.data.EDAData, fig: matplotlib.figure.Figure | None = None, ax: matplotlib.axes.Axes | None = None, lmbda_range: tuple[float, float] = (-2, 2), n: int = 100) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes][source]
Creates a Box-Cox linearity plot.
Plots
abs(corr(Y, X^λ))across a range of λ values to find the power transformation of X that maximises linearity with Y.- Parameters:
data – EDAData container. Requires x > 0.
fig – Matplotlib figure. If None, creates new figure.
ax – Matplotlib axes. If None, creates new axes.
lmbda_range – (min, max) range of λ to evaluate.
n – Number of λ values to evaluate.
- Returns:
The figure and axes containing the plot.