ggplot2
What is ggplot2
ggplot2 is a widely-used R package for data visualisation. I think it provides a good balance between providing aesthetically pleasing plots easily and offering fine-grained ability to control details: you can get most of the way to a great plot very easily.
I do admit, that I often spend most of my time getting the final details right.
Currently, ggplot2 is my primary tool for producing plots that I wish to share publicly. For more exploratory data visualisation work, I use this package slightly more frequently than the graphical functions in base R.
Learning ggplot2
Introducing ggplot2 is beyond the ambition of this site. However, there are many resources available to learners. In particular I will point to three that I have firsthand experience with.
- Data Science: Visualization on edX (HarvardX: PH125.2x)
- I came across this course after several years of using ggplot2. In my opinion it gives a very good explanation of the underlying concepts. This is my first choice recommendation to someone learning to use ggplot2.
- R for Data Science
- This book is well-written and easy to follow. While it addresses a wider range of topics, ggplot2 is covered well at the very beginning of the book . This is not an encyclopedic resource but certainly provides a good platform to subsequently progress to expert-level proficiency. This is the best introduction/coverage of ggplot2 I have come across in a general purpose R book. This book places a heavy emphasis on using the packages of the tidyverse so its suitability for you depend on any preference you may (or may not) have for using those packages.
- ggplot2: Elegant Graphics for Data Analysis (Use R!)
- This book is now dated and, in my opinion, has been superceded by the project’s website. However it is the resource that allowed me to go from copy-pasting and tweaking code from other plots to building plots from the ground up relatively fluently. I have owned a physical copy of this book for several years and I still consult it regularly. It was written by ggplot2’s author, Hadley Wickham when the package was still considered new.