Learn R Programming

{ggstatsplot}: {ggplot2} Based Plots with Statistical Details

StatusUsageMiscellaneous

Raison d’être

“What is to be sought in designs for the display of information is the clear portrayal of complexity. Not the complication of the simple; rather … the revelation of the complex.” - Edward R. Tufte

{ggstatsplot} is an extension of {ggplot2} package for creating graphics with details from statistical tests included in the information-rich plots themselves. In a typical exploratory data analysis workflow, data visualization and statistical modeling are two different phases: visualization informs modeling, and modeling in its turn can suggest a different visualization method, and so on and so forth. The central idea of {ggstatsplot} is simple: combine these two phases into one in the form of graphics with statistical details, which makes data exploration simpler and faster.

Installation

TypeCommand
Releaseinstall.packages("ggstatsplot")
Developmentpak::pak("IndrajeetPatil/ggstatsplot")

Citation

If you want to cite this package in a scientific journal or in any other context, run the following code in your R console:

citation("ggstatsplot")
To cite package 'ggstatsplot' in publications use:

  Patil, I. (2021). Visualizations with statistical details: The
  'ggstatsplot' approach. Journal of Open Source Software, 6(61), 3167,
  doi:10.21105/joss.03167

A BibTeX entry for LaTeX users is

  @Article{,
    doi = {10.21105/joss.03167},
    url = {https://doi.org/10.21105/joss.03167},
    year = {2021},
    publisher = {{The Open Journal}},
    volume = {6},
    number = {61},
    pages = {3167},
    author = {Indrajeet Patil},
    title = {{Visualizations with statistical details: The {'ggstatsplot'} approach}},
    journal = {{Journal of Open Source Software}},
  }

Acknowledgments

I would like to thank all the contributors to {ggstatsplot} who pointed out bugs or requested features I hadn’t considered. I would especially like to thank other package developers (especially Daniel Lüdecke, Dominique Makowski, Mattan S. Ben-Shachar, Brenton Wiernik, Patrick Mair, Salvatore Mangiafico, etc.) who have patiently and diligently answered my relentless questions and supported feature requests in their projects. I also want to thank Chuck Powell for his initial contributions to the package.

The hexsticker was generously designed by Sarah Otterstetter (Max Planck Institute for Human Development, Berlin). This package has also benefited from the larger #rstats community on Twitter, LinkedIn, and StackOverflow.

Thanks are also due to my postdoc advisers (Mina Cikara and Fiery Cushman at Harvard University; Iyad Rahwan at Max Planck Institute for Human Development) who patiently supported me spending hundreds (?) of hours working on this package rather than what I was paid to do.

Copy Link

Version

Install

install.packages('ggstatsplot')

Monthly Downloads

9,145

Version

0.13.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Indrajeet Patil

Last Published

May 10th, 2025

Functions in ggstatsplot (0.13.1)

ggstatsplot-package

ggstatsplot: 'ggplot2' Based Plots with Statistical Details
grouped_ggdotplotstats

Grouped histograms for distribution of a labeled numeric variable
ggwithinstats

Box/Violin plots for repeated measures comparisons
ggpiestats

Pie charts with statistical tests
grouped_ggbarstats

Grouped bar charts with statistical tests
grouped_ggcorrmat

Visualization of a correlalogram (or correlation matrix) for all levels of a grouping variable
ggscatterstats

Scatterplot with marginal distributions and statistical results
gghistostats

Histogram for distribution of a numeric variable
grouped_ggbetweenstats

Violin plots for group or condition comparisons in between-subjects designs repeated across all levels of a grouping variable.
ggdotplotstats

Dot plot/chart for labeled numeric data.
reexports

Objects exported from other packages
grouped_ggpiestats

Grouped pie charts with statistical tests
theme_ggstatsplot

Default theme used in {ggstatsplot}
grouped_ggwithinstats

Violin plots for group or condition comparisons in within-subjects designs repeated across all levels of a grouping variable.
grouped_gghistostats

Grouped histograms for distribution of a numeric variable
grouped_ggscatterstats

Scatterplot with marginal distributions for all levels of a grouping variable
movies_long

Movie information and user ratings from IMDB.com (long format).
iris_long

Edgar Anderson's Iris Data in long format.
extract_stats

Extracting data frames or expressions from {ggstatsplot} plots
ggbarstats

Stacked bar charts with statistical tests
.grouped_list

Split data frame into a list by grouping variable
ggbetweenstats

Box/Violin plots for between-subjects comparisons
ggcoefstats

Dot-and-whisker plots for regression analyses
ggcorrmat

Visualization of a correlation matrix
combine_plots

Combining and arranging multiple plots in a grid
bugs_long

Tidy version of the "Bugs" dataset.
Titanic_full

Titanic dataset.
.is_palette_sufficient

Check if palette has enough number of colors