API reference#
Theme and palette#
Return the depictr plotnine theme. |
|
A discrete colour scale drawn from |
|
A discrete fill scale drawn from |
|
Theme fragment that moves the legend into the plotting area. |
|
Return a depictr palette. |
|
Return the depictr brand colour as a hex string. |
|
Return the depictr accent colour as a hex string. |
Accessibility#
Check that a palette stays distinguishable under each deficiency. |
|
Simulate how a palette appears under a colour-vision deficiency. |
Exploratory analysis#
Plot the distribution of a numeric variable, optionally split by a group. |
|
Bar chart of a categorical variable, optionally grouped (dodged). |
|
Plot the relationship between two columns, choosing the plot from their types. |
|
Scatter plot with a fitted trend line and confidence band. |
|
Heatmap of pairwise Pearson correlations among numeric columns. |
|
Tile map of missing values, one column per variable and one row per record. |
|
Empirical cumulative distribution function, one step curve per group. |
|
Overlapping densities, one ridge per group level. |
|
Dumbbell plot pairing two group values per category. |
|
Box plot of one variable with outliers flagged in the accent colour. |
|
Group means with confidence intervals over the raw points. |
|
Raincloud plot of a numeric variable, optionally split by a group. |
|
Scatter-plot matrix over a few numeric columns. |
Estimation and tables#
Cumming-style estimation plot of mean differences. |
|
Build a "Table 1" descriptive summary. |
Model estimates#
Forest (dot-and-whisker) plot of model coefficients. |
|
Coerce a fitted model or an estimate table into one tidy frame. |
|
Predicted response as one predictor varies, with a confidence band. |
|
Predicted response across |
|
Dodged forest comparing each coefficient across several models. |
|
Caterpillar plot of the predicted random effects (BLUPs). |
|
Forest plot of posterior (or bootstrap) draws. |
|
Overlay a frequentist estimate against a Bayesian posterior per term. |
|
Line plot of statistical power against sample size. |
Diagnostics#
Normal quantile-quantile plot of the residuals, with a reference line. |
|
Bubble plot of studentised residuals against leverage. |
|
Horizontal bar chart of the variance inflation factor per predictor. |
|
Binned residual plot for a binomial GLM (Gelman & Hill, 2007). |
|
Four-panel residual report for a fitted OLS or GLM. |
|
One-figure dashboard pairing the coefficient plot with key diagnostics. |
Classification#
ROC curve with the area under the curve (AUC) annotated. |
|
Precision-recall curve with the average precision (AP) annotated. |
|
Confusion-matrix heatmap. |
|
Reliability (calibration) curve of predicted vs observed frequencies. |
|
Cumulative gains chart: positives captured as more of the ranked population is targeted. |
|
Cumulative lift chart. |
|
Sensitivity, specificity, precision and F1 across the decision threshold. |
Multivariate#
PCA biplot: observations on the first two components, with loading arrows. |
|
Scree plot: variance explained per component, with the cumulative line. |
|
k-means clusters drawn on the first two principal components. |
|
Hierarchical-clustering dendrogram drawn from a scipy linkage. |
|
Silhouette widths per observation, grouped and ordered by cluster. |
Survival#
Kaplan-Meier survival curves, optionally by group, with a log-rank test. |
Time series#
Autocorrelation or partial autocorrelation as a stem plot. |
|
Seasonal decomposition as a stacked, facetted figure. |
|
Seasonal subseries plot: value by position in the period, one line per cycle. |
|
The series as a line, optionally with a rolling-mean overlay. |
Composition and data#
Arrange several plots into one composed figure. |
|
Save a depictr/plotnine plot at publication resolution. |
|
A field trial with a genuine fertiliser-by-treatment interaction. |
|
A cross-sectional survey with informative missingness in income. |
|
A priming reaction-time/accuracy experiment. |
|
A two-arm trial with separating survival curves and a rare adverse event. |