Skip to content

hssm.plotting

The hssm.plotting module provide functionalities to create HSSM-specific plots such as the posterior predictive plots. Please checkout the plotting tutorial for more examples on how to use these functions. Note that each plotting function has an equivalent in the hssm.HSSM class, so you can call these functions from a built model without having to import these functions.

hssm.plotting

Plotting functionalities for HSSM.

Modules:

  • model_cartoon

    Plotting functionalities for HSSM.

  • predictive

    Plotting functionalities for HSSM.

  • quantile_probability

    Code for producing quantile probability plots.

  • utils

    Plotting utilities for HSSM.

Functions:

hssm.plotting.plot_model_cartoon

plot_model_cartoon(
    model,
    dt: DataTree | None = None,
    data: DataFrame | None = None,
    predictive_group: Literal[
        "posterior_predictive", "prior_predictive"
    ] = "posterior_predictive",
    plot_data: bool = True,
    n_samples: int | float | None = 20,
    n_samples_prior: int = 500,
    row: str | None = None,
    col: str | None = None,
    col_wrap: int | None = None,
    groups: str | Iterable[str] | None = None,
    groups_order: Iterable[str] | dict[str, Iterable[str]] | None = None,
    bins: int | ndarray | str | None = None,
    step: bool = True,
    hdi: float | str | tuple[float, float] | list | None = None,
    uncertainty: Literal["band", "samples", "both"] | None = "band",
    alpha_mean: float = 1.0,
    alpha_uncertainty: float | None = None,
    hist_height: float | Literal["auto"] | None = None,
    plot_predictive_mean: bool | None = None,
    plot_predictive_samples: bool | None = None,
    colors: str | list[str] | dict[str, str] | None = None,
    linestyles: str | list[str] | tuple[str] | dict[str, str] = "-",
    linewidths: float | list[float] | tuple[float] | dict[str, float] = 1.25,
    title: str | None = "Posterior Predictive Distribution",
    xlabel: str | None = "Response Time",
    ylabel: str | None = "",
    legend: bool = True,
    obs: int | None = None,
    random_state: int | Generator | None = None,
    n_trajectories: int | None = None,
    xlims: tuple[float, float] | None = None,
    ylims: tuple[float, float] | Literal["auto"] | None = None,
    grid_kwargs: dict | None = None,
    **kwargs,
) -> Axes | FacetGrid | list[FacetGrid]

Plot the posterior predictive distribution against the observed data.

Note (aDDM / covariate models): this cartoon re-simulates at the posterior-mean parameters with the simulator self-sampling its own fixation sequence (Mode 1) and regenerates its predictive with the model's default continuation policy. It does NOT condition on the observed fixations, and a continuation_mode passed to sample_posterior_predictive does not reach it, so it is a schematic of the fitted drift/boundary geometry, not the fixation-conditioned predictive check. Tracked in lnccbrown/HSSM#1039.

Parameters:

  • model (HSSM) –

    A fitted HSSM model.

  • dt (optional, default: None ) –

    The DataTree object with posterior samples. If not provided, will use the traces object stored inside the model. If posterior predictive samples are not present in this object, will generate posterior predictive samples using the this DataTree object and the original data.

  • data (optional, default: None ) –

    The observed data.

    • If data is provided and the dt object does not contain a "posterior_predictive" group, will generate posterior predictive samples using covariate provided in this object. If the group does exist, it is assumed that the posterior predictive samples are generated with the covariates provided in this DataFrame.
    • If data is not provided (i.e., data=None), the behavior depends on whether "plot_data" is true or not. If plot_data=True, the plotting function will use the data stored in the model object and proceed as the case above. If plot_data=False, if posterior predictive samples are not present in the dt object, the plotting function will generate posterior predictive samples using the data stored in the model object. If posterior predictive samples exist in the dt object, these samples will be used for plotting, but a ValueError will be thrown if any of col or row is not None.
  • predictive_group (optional, default: 'posterior_predictive' ) –

    The type of predictive distribution to plot, by default "posterior_predictive". Can be "posterior_predictive" or "prior_predictive".

  • plot_data (optional, default: True ) –

    Whether to plot the observed data, by default True.

  • n_samples (optional, default: 20 ) –

    When dt is provided, the number or proportion of predictive samples randomly drawn to be used from each chain for plotting. When dt is not provided, the number or proportion of posterior/prior samples to be used to generate predictive samples. The number or proportion are defined as follows:

    • When an integer >= 1, the number of samples to be extracted from the draw dimension.
    • When a float between 0 and 1, the proportion of samples to be extracted from the draw dimension.
    • When None, all samples are extracted.
  • n_samples_prior (int, default: 500 ) –

    When predictive_group is "prior_predictive", the number or proportion of prior samples to be used to generate predictive samples. The number or proportion are defined as follows: - When an integer >= 1, the number of samples to be drawn from the prior and respectively from the prior predictive.

  • row (optional, default: None ) –

    Variables that define subsets of the data, which will be drawn on the row dimension of the facets in the grid. When both row and col are None, one single plot will be produced, by default None.

  • col (optional, default: None ) –

    Variables that define subsets of the data, which will be drawn on the column dimension of the facets in the grid. When both row and col are None, one single plot will be produced, by default None.

  • col_wrap (optional, default: None ) –

    “Wrap” the column variable at this width, so that the column facets span multiple rows. Incompatible with a row facet., by default None.

  • groups (optional, default: None ) –

    Additional dimensions along which to plot different groups. This is useful when there are 3 or more dimensions of covariates to plot against, by default None.

  • groups_order (optional, default: None ) –

    The order to plot the groups, by default None, in which case the order is the order in which the groups appear in the data. Only when groups is a string, this can be an iterable of strings. Otherwise, this is a dictionary mapping the dimension name to the order of the groups in that dimension.

  • bins (optional, default: None ) –

    Specification of the RT-histogram bins, by default None, which keeps the legacy grid of bin_size-spaced edges over the x-range (bin_size can be passed as a keyword argument, default 0.05). Otherwise one of: - A string describing the binning strategy (passed to np.histogram_bin_edges). - A list-like defining the bin edges. - An integer defining the number of bins to be used. An explicit bins wins over bin_size.

  • step (optional, default: True ) –

    If True (default), histogram curves are drawn as edge-anchored step outlines; if False, as frequency polygons through the bin centers.

  • hdi (optional, default: None ) –

    The interval(s) displayed by the uncertainty bands, by default None, which becomes graded 50% and 94% equal-tailed intervals. Accepts a float mass (0.94), a "94%" string, a legacy (lo, hi) quantile tuple, or a list of any of these for multiple graded bands. Despite the name, intervals are equal-tailed, not highest-density.

  • uncertainty (optional, default: 'band' ) –

    How posterior predictive uncertainty is displayed (same vocabulary as plot_predictive), by default "band": - "band": graded pointwise quantile bands on the RT histograms, fan-chart ribbons on the decision bounds, a graded drift-quantile fan, graded non-decision-time spans, and a starting-point whisker. - "samples": per-draw translucent curves (the classic spaghetti), with a rug of non-decision-time ticks instead of per-draw vertical lines. - "both": samples underneath bands. - None: the mean-only rendering (the previous default look).

  • alpha_mean (optional, default: 1.0 ) –

    Opacity of the predictive-mean / reference-geometry artists, by default 1.0.

  • alpha_uncertainty (optional, default: None ) –

    Opacity of the uncertainty layer, by default None: bands use a 0.25 base with a graded ladder, and sample curves get an automatic per-curve value that keeps total ink roughly constant. An explicit 0.0 is honored.

  • hist_height (optional, default: None ) –

    If a float, rescale all RT-histogram curves by one common factor so the tallest curve has this height in y-data units above its bound. If "auto", fit the tallest curve to 90% of the vertical headroom between the histogram baseline (or the highest visible boundary- ribbon point, whichever is higher) and the upper y-limit, so histograms can never overrun the axes; under faceting the fit is per facet. By default None (raw defective-density units, which can overrun the y-limits for very peaked distributions).

  • plot_predictive_mean (optional, default: None ) –

    Deprecated boolean spellings of uncertainty; mapped with a FutureWarning. (True, False) means uncertainty=None; any combination with samples on maps to "samples" (mean suppressed via alpha_mean=0 when plot_predictive_mean=False). Passing these together with an explicit uncertainty raises a ValueError.

  • plot_predictive_samples (optional, default: None ) –

    Deprecated boolean spellings of uncertainty; mapped with a FutureWarning. (True, False) means uncertainty=None; any combination with samples on maps to "samples" (mean suppressed via alpha_mean=0 when plot_predictive_mean=False). Passing these together with an explicit uncertainty raises a ValueError.

  • colors (optional, default: None ) –

    Colors to use for the different levels of the hue variable. When a str, the color of posterior predictives, in which case an error will be thrown if plot_data is True. When a length-2 iterable, indicates the colors in the order of posterior predictives and observed data. The values must be interpretable by matplotlib. When None, use default color palette, by default None.

  • linestyles (optional, default: '-' ) –

    Linestyles to use for the different levels of the hue variable. When a str, the linestyle of both distributions. When a length-2 iterable, indicates the linestyles in the order of posterior predictives and observed data. The values must be interpretable by matplotlib. When None, use solid lines, by default "-". When dictionary, the keys must be 'predicted' and/or 'observed', and the values must be interpretable by matplotlib.

  • linewidths (optional, default: 1.25 ) –

    Linewidths to use for the different levels of the hue variable. When a float, the linewidth of both distributions. When a length-2 iterable, indicates the linewidths in the order of posterior predictives and observed data, by default 1.25.

  • title (optional, default: 'Posterior Predictive Distribution' ) –

    The title of the plot, by default "Posterior Predictive Distribution". Ignored when groups is provided.

  • xlabel (optional, default: 'Response Time' ) –

    The label for the x-axis, by default "Response Time".

  • ylabel (optional, default: '' ) –

    The label for the y-axis, by default "Density".

  • legend (optional, default: True ) –

    Whether to draw a legend assembled from the labeled plot layers, by default True.

  • obs (optional, default: None ) –

    The obs_n label of one trial to condition the cartoon on. By default (None), the drawn geometry of each posterior draw derives from that draw's trial-mean parameter vector, while the RT histograms stay marginal over all trials (they are a predictive check against the pooled observed data). With obs set, every simulated layer — geometry, predicted histograms, and trajectories — conditions on that trial's parameters; the observed-data histogram remains pooled (a warning notes this). Under faceting, the label must be present in every facet. Note the geometry is nonlinear in the parameters, so the curve drawn at the trial-mean θ is not the mean of per-trial curves and need not sit mid-band; the reduction is a display convention.

  • random_state (optional, default: None ) –

    Seed (or an existing np.random.Generator) making the whole figure reproducible: which posterior draws are displayed, every simulator seed, and the trajectories. Stream order: the predictive draw subset first, then per facet the plug-in simulation seed, one seed per posterior draw, and one trial pick + seed per trajectory. By default None (fresh entropy — a new figure every call).

  • n_trajectories (optional, default: None ) –

    Number of example diffusion trajectories drawn at the reduced reference θ. By default None, keeping each renderer's default (0 for 2-choice, 10 for >2-choice — a historical inconsistency preserved for compatibility).

  • xlims (optional, default: None ) –

    The x-axis limits (t_low, t_high) in seconds. Also determines the geometry simulation horizon (max_t = xlim_high + 0.5). By default None, keeping renderer defaults ((-0.05, 5) for 2-choice, (0, 5) for

    2-choice).

  • ylims (optional, default: None ) –

    The y-axis limits. If "auto", keep the histograms at raw density scale and grow the frame instead so nothing is clipped (the tallest drawn side plus the visible boundary-ribbon top get 90% of the frame; limits never shrink below the defaults, and the 2-choice frame stays symmetric). Mutually exclusive with hist_height="auto" — one fits the content into the frame, the other fits the frame around the content. By default None, keeping renderer defaults ((-3, 3) for 2-choice, (0, 5) for >2-choice).

  • grid_kwargs (optional, default: None ) –

    Additional keyword arguments are passed to the [FacetGrid constructor] (https://seaborn.pydata.org/generated/seaborn.FacetGrid.html#seaborn.FacetGrid.init) when any of row or col is provided. When producing a single plot, these arguments are ignored.

  • kwargs (optional, default: {} ) –

    Additional keyword arguments passed to ax.plot() functions.

Returns:

  • Axes | FacetGrid | list[FacetGrid]

    The matplotlib axis or seaborn FacetGrid object containing the plot.

hssm.plotting.plot_predictive

plot_predictive(
    model,
    dt: DataTree | None = None,
    data: DataFrame | None = None,
    predictive_group: Literal[
        "posterior_predictive", "prior_predictive"
    ] = "posterior_predictive",
    plot_data: bool = True,
    n_samples: int | float | None = 20,
    row: str | None = None,
    col: str | None = None,
    col_wrap: int | None = None,
    groups: str | Iterable[str] | None = None,
    groups_order: Iterable[str] | dict[str, Iterable[str]] | None = None,
    kind: Literal["hist", "kde"] = "hist",
    bins: int | ndarray | str | None = 50,
    grid_points: int = 256,
    bw_method: str | float | None = None,
    x_range: tuple[float, float] | None = None,
    step: bool = True,
    hdi: float | str | tuple[float, float] | list | None = None,
    uncertainty: Literal["band", "samples", "both"] | None = "band",
    alpha_mean: float = 1.0,
    alpha_uncertainty: float | None = None,
    colors: str | list[str] | dict[str, str] | None = None,
    linestyles: str | list[str] | tuple[str] | dict[str, str] = "-",
    linewidths: float | list[float] | tuple[float] | dict[str, float] = 1.25,
    title: str | None = _DEFAULT_TITLE,
    xlabel: str | None = _DEFAULT_XLABEL,
    ylabel: str | None = "Density",
    legend: bool = True,
    grid_kwargs: dict | None = None,
    **kwargs,
) -> Axes | sns.FacetGrid | list[sns.FacetGrid]

Plot the posterior predictive distribution against the observed data.

Parameters:

  • model (HSSM) –

    A fitted HSSM model.

  • dt (optional, default: None ) –

    The DataTree object with posterior samples. If not provided, will use the traces object stored inside the model. If posterior predictive samples are not present in this object, will generate posterior predictive samples using this DataTree object and the original data.

  • data (optional, default: None ) –

    The observed data.

    • If data is provided and the dt object does not contain a "posterior_predictive" group, will generate posterior predictive samples using covariate provided in this object. If the group does exist, it is assumed that the posterior predictive samples are generated with the covariates provided in this DataFrame.
    • If data is not provided (i.e., data=None), the behavior depends on whether "plot_data" is true or not. If plot_data=True, the plotting function will use the data stored in the model object and proceed as the case above. If plot_data=False, if posterior predictive samples are not present in the dt object, the plotting function will generate posterior predictive samples using the data stored in the model object. If posterior predictive samples exist in the dt object, these samples will be used for plotting, but a ValueError will be thrown if any of col or row is not None.
  • predictive_group (optional, default: 'posterior_predictive' ) –

    The type of predictive distribution to plot, by default "posterior_predictive". Can be "posterior_predictive" or "prior_predictive".

  • plot_data (optional, default: True ) –

    Whether to plot the observed data, by default True.

  • n_samples (optional, default: 20 ) –

    When dt is provided, the number or proportion of posterior predictive samples randomly drawn to be used from each chain for plotting. When dt is not provided, the number or proportion of posterior samples to be used to generate posterior predictive samples. The number or proportion are defined as follows:

    • When an integer >= 1, the number of samples to be extracted from the draw dimension.
    • When a float between 0 and 1, the proportion of samples to be extracted from the draw dimension.
    • When None, all samples are extracted.
  • row (optional, default: None ) –

    Variables that define subsets of the data, which will be drawn on the row dimension of the facets in the grid. When both row and col are None, one single plot will be produced, by default None.

  • col (optional, default: None ) –

    Variables that define subsets of the data, which will be drawn on the column dimension of the facets in the grid. When both row and col are None, one single plot will be produced, by default None.

  • col_wrap (optional, default: None ) –

    “Wrap” the column variable at this width, so that the column facets span multiple rows. Incompatible with a row facet., by default None.

  • groups (optional, default: None ) –

    Additional dimensions along which to plot different groups. This is useful when there are 3 or more dimensions of covariates to plot against, by default None.

  • groups_order (optional, default: None ) –

    The order to plot the groups, by default None, in which case the order is the order in which the groups appear in the data. Only when groups is a string, this can be an iterable of strings. Otherwise, this is a dictionary mapping the dimension name to the order of the groups in that dimension.

  • kind (optional, default: 'hist' ) –

    The density estimator drawn for every curve, by default "hist": - "hist": binned histogram densities (see bins, step). - "kde": Gaussian kernel density estimates evaluated on a shared grid (see grid_points, bw_method). On the signed-RT axis the KDE is fit separately per choice side, weighted by response proportion, so no density is smoothed across the gap at zero.

  • bins (optional, default: 50 ) –

    Specification of hist bins (kind="hist" only), by default 50. There are three options: - A string describing the binning strategy (passed to np.histogram_bin_edges). - A list-like defining the bin edges. - An integer defining the number of bins to be used.

  • grid_points (optional, default: 256 ) –

    Number of grid points the KDE is evaluated on (kind="kde" only), by default 256.

  • bw_method (optional, default: None ) –

    Bandwidth selection passed to scipy.stats.gaussian_kde (kind="kde" only), by default None (Scott's rule).

  • x_range (optional, default: None ) –

    The lower and upper range of the bins. If not provided, the range spans the 1%-99% quantiles of the predictive samples, widened to include all observed data (so observations are never silently clipped), by default None.

  • step (optional, default: True ) –

    Whether to plot the distributions as edge-anchored step histograms (True, the default) or as frequency polygons through the bin centers (False).

  • hdi (optional, default: None ) –

    The uncertainty interval(s) to display when uncertainty includes bands, by default None, which plots graded 50% and 94% bands. Accepts: - A float mass, e.g. 0.9 for a symmetric 90% interval. - A percentage string, e.g. "90%". - A (lo, hi) tuple of quantiles, e.g. (0.05, 0.95). - A list of any of the above, one entry per graded band. Intervals are equal-tailed percentile intervals across posterior predictive draws (not highest-density intervals). There should be at least ~50 predicted trials per draw for the bands to be reliable; a warning is logged when there are fewer.

  • uncertainty (optional, default: 'band' ) –

    How to display uncertainty across posterior predictive draws, by default "band": - "band": graded quantile ribbons around the predictive mean. - "samples": each retained posterior draw as a translucent curve under an opaque mean, in the style of plot_model_cartoon. - "both": sample curves with band ribbons on top. - None: only the predictive mean is drawn (the pre-0.5 behavior).

  • alpha_mean (optional, default: 1.0 ) –

    Opacity of the predictive mean curve, by default 1.0.

  • alpha_uncertainty (optional, default: None ) –

    Opacity of the uncertainty display, by default None, which resolves to 0.25 for the innermost band (outer bands are scaled down) and an automatic per-curve alpha for "samples" based on the number of draws.

  • colors (optional, default: None ) –

    Colors to use for the different levels of the hue variable. When a str, the color of posterior predictives, in which case an error will be thrown if plot_data is True. When a length-2 iterable, indicates the colors in the order of posterior predictives and observed data. When a dict, the keys must be 'predicted' and/or 'observed'. The values must be interpretable by matplotlib. When None, use the default palette, by default None.

  • linestyles (optional, default: '-' ) –

    Linestyles to use for the different levels of the hue variable. When a str, the linestyle of both distributions. When a length-2 iterable, indicates the linestyles in the order of posterior predictives and observed data. The values must be interpretable by matplotlib. When None, use solid lines, by default "-". When dictionary, the keys must be 'predicted' and/or 'observed', and the values must be interpretable by matplotlib.

  • linewidths (optional, default: 1.25 ) –

    Linewidths to use for the different levels of the hue variable. When a float, the linewidth of both distributions. When a length-2 iterable, indicates the linewidths in the order of posterior predictives and observed data, by default 1.25.

  • title (optional, default: _DEFAULT_TITLE ) –

    The title of the plot, by default "Posterior Predictive Distribution". Ignored when groups is provided.

  • xlabel (optional, default: _DEFAULT_XLABEL ) –

    The label for the x-axis, by default "Response Time" — automatically annotated as "Response Time (sign = choice)" on 2-choice models, where the negative half-axis carries the other choice.

  • ylabel (optional, default: 'Density' ) –

    The label for the y-axis, by default "Density".

  • legend (optional, default: True ) –

    Whether to draw a legend, by default True. No legend is drawn when the plot contains only the predictive mean (plot_data=False with uncertainty=None) — a single-series legend adds no information.

  • grid_kwargs (optional, default: None ) –

    Additional keyword arguments are passed to the [sns.FacetGrid constructor] (https://seaborn.pydata.org/generated/seaborn.FacetGrid.html#seaborn.FacetGrid.init) when any of row or col is provided. When producing a single plot, these arguments are ignored.

  • kwargs (optional, default: {} ) –

    Additional keyword arguments passed to ax.plot() functions.

Returns:

  • Axes | FacetGrid | list[FacetGrid]

    The matplotlib axis or seaborn FacetGrid object containing the plot.

hssm.plotting.plot_quantile_probability

plot_quantile_probability(
    model,
    cond: str,
    data: DataFrame | None = None,
    dt: DataTree | None = None,
    predictive_group: Literal["posterior_predictive", "prior_predictive"]
    | None = "posterior_predictive",
    n_samples: int = 20,
    x: str = "proportion",
    y: str = "rt",
    hue: str = "quantile",
    row: str | None = None,
    col: str | None = None,
    col_wrap: int | None = None,
    groups: str | Iterable[str] | None = None,
    groups_order: Iterable[str] | dict[str, Iterable[str]] | None = None,
    predictive_style: Literal["points", "ellipse", "both"] = "points",
    ellipse_confidence: float = 0.95,
    ellipse_min_points: int = 5,
    correct: str | None = None,
    q: int | Iterable[float] = 5,
    quantile_by: list[str] | str | None = None,
    title: str | None = "Quantile Probability Plot",
    xlabel: str | None = "Proportion",
    ylabel: str | None = None,
    xticklabels: Iterable[str] | None = None,
    grid_kwargs: dict[str, Any] | None = None,
    data_kwargs: dict[str, Any] | None = None,
    predictive_samples_kwargs: dict[str, Any] | None = None,
    ellipse_kwargs: dict[str, Any] | None = None,
    **kwargs,
) -> Axes | FacetGrid | list[FacetGrid]

Plot the quantile probabilities against the observed data.

Parameters:

  • model

    A model object that has a plot_quantile_probability method.

  • cond (str) –

    The column in data that indicates the conditions.

  • data (optional, default: None ) –

    A pandas DataFrame containing the observed data. If None, the data from dt.observed_data will be used.

  • dt (optional, default: None ) –

    An xarray DataTree object. If None, the model's trace will be used. If the model's trace does not contain posterior predictive samples, and "plot_predictive" is True, will use the model and data to produce posterior predictive samples.

  • predictive_group (optional, default: 'posterior_predictive' ) –

    The type of predictive distribution to plot, by default "posterior_predictive". Can be "posterior_predictive" or "prior_predictive".

  • n_samples (optional, default: 20 ) –

    When dt is provided, the number or proportion of posterior predictive samples randomly drawn to be used from each chain for plotting. When dt is not provided, the number or proportion of posterior samples to be used to generate posterior predictive samples. The number or proportion are defined as follows:

    • When an integer >= 1, the number of samples to be extracted from the draw dimension.
    • When a float between 0 and 1, the proportion of samples to be extracted from the draw dimension.
    • When None, all samples are extracted.
  • x (optional, default: 'proportion' ) –

    The column in data that indicates the x-axis variable. By default, this is "proportion", which is the proportion of (in)correct responses in each group in cond.

  • y (optional, default: 'rt' ) –

    The column in data that indicates the y-axis variable. By default, this is "rt", which is the response time.

  • hue (optional, default: 'quantile' ) –

    The column in data that indicates the hue variable. By default, this is "quantile", which is the quantile of the response time.

  • row (optional, default: None ) –

    Variables that define subsets of the data, which will be drawn on the row dimension of the facets in the grid. When both row and col are None, one single plot will be produced, by default None.

  • col (optional, default: None ) –

    Variables that define subsets of the data, which will be drawn on the column dimension of the facets in the grid. When both row and col are None, one single plot will be produced, by default None.

  • col_wrap (optional, default: None ) –

    “Wrap” the column variable at this width, so that the column facets span multiple rows. Incompatible with a row facet., by default None.

  • groups (optional, default: None ) –

    Additional dimensions along which to plot different groups. This is useful when there are 3 or more dimensions of covariates to plot against, by default None.

  • groups_order (optional, default: None ) –

    The order to plot the groups, by default None, in which case the order is the order in which the groups appear in the data. Only when groups is a string, this can be an iterable of strings. Otherwise, this is a dictionary mapping the dimension name to the order of the groups in that dimension.

  • predictive_style ((points, ellipse, both), default: 'points' ) –

    How to plot posterior predictive samples: - 'points': Traditional scatter plot (default) - 'ellipse': Confidence ellipses for each quantile+condition group - 'both': Both points and ellipses

  • ellipse_confidence (float, default: 0.95 ) –

    Confidence level for ellipses (0 to 1). Only used when predictive_style is 'ellipse' or 'both'. For example, 0.95 creates ellipses that contain approximately 95% of the probability mass for each quantile+condition group.

  • ellipse_min_points (int, default: 5 ) –

    Minimum number of points required to draw an ellipse. Groups with fewer points will be skipped with a debug warning.

  • correct (optional, default: None ) –

    The column in data that indicates the correct responses. If None, response column from data indicates whether the response is correct or not. By default None.

  • q (optional, default: 5 ) –

    If an int, quantiles will be determined using np.linspace(0, 1, q) (0 and 1 will be excluded. If an iterable, will generate quantiles according to this iterable.

  • title (optional, default: 'Quantile Probability Plot' ) –

    The title of the plot, by default "Quantile Probability Plot". Ignored when groups is provided.

  • xlabel (optional, default: 'Proportion' ) –

    The label for the x-axis, by default "Proportion".

  • ylabel (optional, default: None ) –

    The label for the y-axis, by default None.

  • xticklabels (optional, default: None ) –

    The labels for groups on the top x-axis, by default None, which will be inferred from the data.

  • grid_kwargs (optional, default: None ) –

    Keyword arguments passed to seaborn.FacetGrid.

  • data_kwargs (optional, default: None ) –

    Keyword arguments passed to seaborn.lineplot.

  • predictive_samples_kwargs (optional, default: None ) –

    Keyword arguments passed to seaborn.scatterplot.

  • ellipse_kwargs (optional, default: None ) –

    Keyword arguments passed to matplotlib.patches.Ellipse. Useful for customizing ellipse appearance (e.g., facecolor, edgecolor, alpha, linewidth).

  • kwargs (optional, default: {} ) –

    Keyword arguments passed to both seaborn.lineplot and seaborn.scatterplot.

Returns:

  • Axes | FacetGrid | list[FacetGrid]

    If neither row, col, nor groups is provided, returns a single Axes object. If row or col is provided (but not groups), returns a FacetGrid object. If groups is provided, returns a list of FacetGrid objects, one for each group.