Chapter 18

Looking At ggplot2 Graphics

In This Chapter

arrow Installing and loading the ggplot2 package

arrow Understanding how to use build a plot using layers

arrow Creating charts with suitable geoms and stats

arrow Adding facets to your plot

One of the strengths of R is that it’s more than just a programming language — it also has thousands of packages written and contributed by independent developers. One of these packages, ggplot2, is tremendously popular and offers a new way of creating insightful graphics using R.

technicalstuff.eps Much of the ggplot2 philosophy is based on the so-called “grammar of graphics,” a theoretically sound way of describing all the components that go into a graphical plot. You don’t need to know anything about the grammar of graphics to use ggplot2 effectively, but now you know where its name comes from.

In this chapter, you first install and load the ggplot2 package and then take a first look at layers, the building blocks of the ggplot2 graphics. Next, you define the data, geoms, and stats ...

Get R For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.