What is a good way to read the source code of ggplot2?

I want to understand better how ggplot2 is implemented. I have read through ggplot2-book.org and use ggplot2 for a few years. Any suggestions about how to read the ggplot2 source code?

The whole sourcecode can be found in the github repository here: https://github.com/tidyverse/ggplot2/

You can also write the name of a function (without the parentheses) an press enter in the command line of press F2 over a function.

Another good resource is the "Extending ggplot2" vignette (https://cran.r-project.org/web/packages/ggplot2/vignettes/extending-ggplot2.html) which guides you through some aspects of ggplot2's internal workings.

1 Like