Advanced topics
As you become more fluent in ggplot2, you may find yourself wanting to use it in more advanced ways. You may want to write your own functions that create plots in a reusable fashion, or you may want to write your own packages that extend ggplot2. If this describes you, then the chapters in this part of the book are designed to get you started. In 18 Programming with ggplot2 we discuss programming techniques you can use to create flexible and reusable ggplot2 visualisations. This is followed by 19 Internals of ggplot2 which dives into the mechanics of what ggplot2 does when creating a plot, and 20 Extending ggplot2 which builds upon this discussion to talk about how ggplot2 extensions are written. Finally, in order to make these ideas a little more concrete, 21 A case study presents a worked example of developing a ggplot2 extension.