drippy.univariate

Plotting functions for univariate models (y = c + e).

Attributes

_ORDERED_VALUES

Functions

run_sequence_plot(→ tuple[matplotlib.figure.Figure, ...)

Creates a run sequence plot of y vs index or continuous index t.

lag_plot(→ tuple[matplotlib.figure.Figure, ...)

Creates a lag plot of the data.

histogram(→ tuple[matplotlib.figure.Figure, ...)

Creates a histogram of the data.

normal_probability_plot(...)

Creates a normal probability plot.

four_plot(→ tuple[matplotlib.figure.Figure, numpy.ndarray])

Creates a 4-plot (run sequence, lag, histogram, normal probability).

ppcc_plot(, n_rough, n_fine, numpy.ndarray])

Creates a PPCC plot (rough + fine) for distribution shape estimation.

weibull_plot(→ tuple[matplotlib.figure.Figure, ...)

Creates a Weibull probability plot.

probability_plot(→ tuple[matplotlib.figure.Figure, ...)

Creates a probability plot for a specified distribution.

box_cox_normality_plot(...)

Creates a Box-Cox normality plot (2x2 grid).

bootstrap_plot(→ tuple[matplotlib.figure.Figure, ...)

Creates a bootstrap distribution plot.

box_cox_linearity_plot(, n, matplotlib.axes.Axes])

Creates a Box-Cox linearity plot.

Module Contents

drippy.univariate._ORDERED_VALUES = 'Ordered Values'[source]
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.