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 Chapter 18 we discuss programming techniques you can use to create flexible and reusable ggplot2 visualisations. This is followed by Chapter 19 which dives into the mechanics of what ggplot2 does when creating a plot, and Chapter 20 which builds upon this discussion to talk about how ggplot2 extensions are written. Finally, in order to make these ideas a little more concrete, Chapter 21 presents a worked example of developing a ggplot2 extension.