Appendix B — Extensions

Most graphs in this book only need ggplot2 and dplyr, but some graph types live in extension packages. The tables below list the extensions (and the helper packages) each chapter uses. I’ve used pak for every install command because it handles packages on CRAN (pak::pak("ggridges")) and GitHub (pak::pak("owner/repo")) the same way.

B.1 Graph extensions

Graph Package Install
Waffle charts ggwaffle pak::pak("liamgilbey/ggwaffle")
Mosaic plots ggmosaic pak::pak("haleyjeppson/ggmosaic")
Pie charts ggpubr pak::pak("ggpubr")
Treemaps treemapify pak::pak("treemapify")
Beeswarm plots ggbeeswarm pak::pak("ggbeeswarm")
Ridgeline plots ggridges pak::pak("ggridges")
Raincloud plots raincloudplots and ggdist pak::pak(c("jorvlan/raincloudplots", "ggdist"))
Bump charts ggbump pak::pak("davidsjoberg/ggbump")
Stream plots ggstream pak::pak("davidsjoberg/ggstream")
Alluvial charts ggalluvial pak::pak("ggalluvial")
Parallel sets ggforce pak::pak("ggforce")
Hexagon bins hexbin (used by geom_hex()) pak::pak("hexbin")

B.2 Helper packages

These packages don’t add new graph types, but a few chapters rely on them to simulate data, combine graphs, or choose colors.

Package What it’s used for Chapters Install
faux Simulating correlated variables (rnorm_multi()) and designs (sim_design()) Cleveland dot plots, raincloud plots, grouped scatter plots, density contours pak::pak("faux")
patchwork Combining graphs into one figure Mosaic plots, overlapping and stacked density plots, grouped line graphs pak::pak("patchwork")
colorspace Sequential color palettes 2D histograms, hexagon bins pak::pak("colorspace")
fmggp2 The 90s themes and book helpers (see Appendix C) Every chapter pak::pak("mjfrigaard/fmggp2")

The code below installs everything at once.

show/hide
pak::pak(c(
  "liamgilbey/ggwaffle", "haleyjeppson/ggmosaic", "ggpubr", "treemapify",
  "ggbeeswarm", "ggridges", "jorvlan/raincloudplots", "ggdist",
  "davidsjoberg/ggbump", "davidsjoberg/ggstream", "ggalluvial", "ggforce", "hexbin",
  "faux", "patchwork", "colorspace", "mjfrigaard/fmggp2"))