- Introduction to ggplot in R
- Annotating ggplot in R
- Facets in ggplot in R
We can use the ggplot2 facet functions to display our data in new ways. Facet functions let you display smaller groups or subsets of your data. A facet is a side or section of an object, like the sides of a gemstone. Facets show different sides of your data by placing each subset on its own plot. You might have categorical data such as male or female. You might have sales data that has a column for region (geographical division). These are subsets of your data.
Ggplot2 has two functions for faceting: facet_wrap and facet_grid.
To compare data trends across average ratings, use a facets function: facet_wrap (~Average Rating).
Palmer Penguins
As an example, we can use the palmer penguins data.