Preface to the third edition

Welcome to the third edition of “ggplot2: elegant graphics for data analysis”. I’m so excited to have a new edition of the book updated for all the changes that have happened to ggplot2 in the last five years. I’m also excited to finally have an online version of the book, <>, thanks to a renegotiated contract with Springer.

Since the last version of the book, the major change to ggplot2 itself is the growth in the contributor community. While I still lead the project and continue to care deeply about visualisation, I’m no longer involved in the day-to-day development of the package. At the time of writing, the core developers of ggplot2 are:

You can see an up-to-date list and how to become a core developer in the ggplot2 governance document.

Major changes

  • The Data Analysis, Data Transformation, and Modelling for Visualisation chapters have been removed so that the book can focus on visualisation. If you’re looking for general advice on doing data science in R, we recommend R for Data Science (2e).

  • The Toolbox chapter has been expanded into six chapters that cover practical applications of layers. This includes more material on maps and annotations, and a new chapter that discusses how to arrange multiple plots on one page.

  • Similarly, the old Scales, Axes, and Legends chapter has been split into into four chapters. The first three cover the practical combination of scales and guides for the most common scale types, and the final chapter focusses on the underlying theory.

  • The old Positioning chapter has been split into new Coordinate Systems and Faceting chapters, giving more room for details on these important topics.

  • New chapters describe more about the internals of ggplot2, and how you can extend it in your own package.


This edition of the book was made possible by two new co-authors: Danielle Navarro and Thomas Lin Pedersen. Danielle contributed most of the new material in the layers and scales chapters, and Thomas contributed new chapters on arranging plots (using his patchwork package), and on how to extend ggplot2.

This book was written in the open and chapters were advertised on twitter when complete. It is truly a community effort: many people read drafts, fixed typos, suggested improvements, and contributed content. Without those contributors, the book wouldn’t be nearly as good as it is, and I’m deeply grateful for their help.

A big thank you to all 34 people who contributed specific improvements via GitHub pull requests (in alphabetical order by username): Alexej Gossmann (@agisga), @chriselrod, Carson Sievert (@cpsievert), Dave Childers (@davechilders), @dicorynia, Dennis Murphy (@djmurphy420), Danielle Navarro (@djnavarro), @dmurdoch, Zhuoer Dong (@dongzhuoer), Dan Yavorsky (@dyavorsky), Francisco Júnior (@fjuniorr), Gökçen Eraslan (@gokceneraslan), jashapiro (@jashapiro), Jim Hester (@jimhester), Jeffrey Girard (@jmgirard), Joel Gombin (@joelgombin), @jonas-hag, @lindbrook, @MarHer90, Mine Cetinkaya-Rundel (@mine-cetinkaya-rundel), Neil McGuigan (@neilmcguigan), Clemens Schmid (@nevrome), Pietro Monticone (@pitmonticone), Patrick Kennedy (@pkq), Robin (@Robinlovelace), Sean Hughes (@seaaan), Thomas Lin Pedersen (@thomasp85), Thomas Klebel (@tklebel), Tom Jemmett (@tomjemmett), Alex Trueman (@truemoid), Will Beasley (@wibeasley), Jake Thompson (@wjakethompson), Yang Cao (@yiluheihei), Hiroaki Yutani (@yutannihilation).