About PyStatlas

Statistical charts for Python, built on real social-science data and organised by the question they answer. Machine learning — how well a model predicts and why — and spatial data — maps and spatial autocorrelation — sit alongside distributions, group comparisons, regression and survival, and every figure reports the statistics behind it: estimates, confidence intervals, tests, effect sizes.

PyStatlas starts from the questions researchers ask, not from the code. It was first written for social-science students who know their field and need to answer a question with data: do these groups differ, do two variables move together, what does the model predict and why? Each chart puts the relevant statistics on the figure and comes with a short, self-contained script built on the scientific Python stack — in the spirit of ggstats and ggstatsplot in R.

Principles

Families

FamilyChartsWhat you'll find
Machine learning9How well does a model predict on new data, and why? Out-of-fold evaluation, learning curves and model-agnostic explanations — each with its uncertainty.
Spatial data4Is a value higher where its neighbours' values are higher? Spatial weights, global and local spatial autocorrelation, and how far clusters reach — on Guerry's 1830s France.
Distributions5See the shape of your data: histograms, densities, ridgelines, ECDFs and Q–Q plots.
Group comparisons5Compare groups with the test, effect size and p-values on the chart — the ggstatsplot way.
Proportions & surveys5Proportions, cross-tabs and Likert scales, in the spirit of ggstats::gglikert and stat_prop.
Correlation & association4Correlation matrices, scatterplots with statistics and pairwise relationships.
Regression models6Coefficient plots, odds ratios, model comparison and marginal effects — ggcoef_model for Python.
Model diagnostics5Residuals, leverage, calibration and ROC curves: check before you trust a model.
Survival analysis4Kaplan–Meier curves with risk tables, cumulative hazards and Cox model hazard ratios.
Time series4Decomposition, autocorrelation, forecasts with prediction intervals and change over time.
Multivariate & clustering4PCA biplots, scree plots, clustering and heatmaps for high-dimensional data.
Inference & uncertainty6Bootstrap, confidence intervals, power, agreement and meta-analysis forest plots.

Author

PyStatlas is created and maintained by Thierry Warin. More of his work on data science, statistics and AI: www.warin.ca.

How to cite

PyStatlas is created and maintained by Thierry Warin. If it helped your work, please cite it.

Warin, T. (2026). PyStatlas: A Python Gallery of Statistical Graphics for the Social Sciences. https://warint.github.io/pystatlas/

@misc{warin2026statlas,
  author       = {Warin, Thierry},
  title        = {PyStatlas: A Python Gallery of Statistical Graphics for the Social Sciences},
  year         = {2026},
  howpublished = {\url{https://warint.github.io/pystatlas/}},
  note         = {Source code: https://github.com/warint/pystatlas}
}

Contribute

Add a folder with a plot.py, run python build.py, open a pull request. See CONTRIBUTING.md.

Thank you

PyStatlas stands on the shoulders of open-source software, open data and the R community. Every example is built with, or inspired by, the work below.

Python packages used in the examples

NumPy · pandas · Matplotlib · seaborn · SciPy · statsmodels · scikit-learn · lifelines · SHAP · GeoPandas · libpysal · esda

Datasets

Inspiration

R packages whose charts the examples mirror

BlandAltmanLeh · blandr · boot · car · caret · ComplexHeatmap · corrplot · dabestr · factoextra · feasts · forecast · GGally · ggdist · ggeffects · ggplot2 · ggpubr · ggrain · ggridges · ggstats · ggstatsplot · iml · interactions · marginaleffects · meta · metafor · pdp · performance · pheatmap · probably · pROC · pwr · qqplotr · quantreg · rgeoda · rms · shapviz · spdep · survminer · TeachingDemos · tune · vcd · vip · yardstick

Building the site

PyYAML · Pygments · Pillow · GitHub Pages

Data sources

Almost every example uses published data, reproduced as distributed with statsmodels, lifelines or R's metafor; the two simulated examples are marked as such. Each entry gives the original reference, how the data reach the gallery, and the charts that use them.

The examples illustrate statistical methods. Their titles describe what each figure shows in these particular data — often a small, dated or partial sample — not the author's position on the substantive question. For interpretation, context and data quality, rely on the original sources cited here.