Major changes

I’ve spent a lot of effort ensuring that this edition is a true upgrade over the first. As well as updating the code everywhere to make sure it’s fully compatible with the latest version of ggplot2, I have:

  • Shown much more code in the book, so it’s easier to use as a reference. Overall the book has a more “knitr”-ish sensibility: there are fewer floating figures and tables, and more inline code. This makes the layout a little less pretty but keeps related items closer together.

  • Published the complete source online at https://github.com/hadley/ggplot2-book.

  • Switched from qplot() to ggplot() in the introduction, Chapter 2. Feedback indicated that qplot() was a crutch: it makes simple plots a little easier, but it doesn’t help with mastering the grammar.

  • Added practice exercises throughout the book so you can practice new techniques immediately after learning about them.

  • Added pointers to the rich ecosystem of packages that have built up around ggplot2. You’ll now see a number of other packages highlighted in the book, and get pointers to other packages I think are particularly useful.

  • Overhauled the toolbox chapter to cover all the new geoms. I’ve added a completely new section on text labels, Section 7.2, since it’s important and not covered in detail elsewhere. The mapping section, Section 6, has been considerably expanded to talk more about the different types of map data, and where you might find them.

  • Completely rewritten the scales chapter, Chapter ??, to focus on the most important tasks. It also discusses the new features that give finer control over legend appearance in Section 10.6, and shows off some of the new scales added to ggplot2 in Section ??.

  • Split the data analysis chapter into three pieces: data tidying (with tidyr), data manipulation (with dplyr), and model visualisation (with broom). I discuss the latest iteration of my data manipulation tools, and introduce the fantastic broom package by David Robinson.

The book is accompanied by a new version of ggplot2: version 2.0.0. This includes a number of minor tweaks and improvements, and considerable improvements to the documentation. Coming back to ggplot2 development after a considerable pause has helped me to see many problems that previously escaped notice. ggplot2 2.0.0 (finally!) contains an official extension mechanism so that others can contribute new ggplot2 components in their own packages. This is documented in a new vignette, vignette("extending-ggplot2").