Faceting is a really efficient way to present information, and Ggplot2 allows to do so really easily. There are 2 main  functions you need to know:

  • facet_wrap()
  • facet_grid()

Let’s start with facet_wrap. It makes a new graphic for each level of a discrete variable. You can add the graphics horizontally (graph1) or vertically (graph2). The grey bar showing the related level can be placed wherever you want (graph3). Last but not least, you can choose whether every graph have the same scale or not (graph4).

The facet_grid function allows to make a grid. It becomes useful when you want to facet following the levels of 2 discrete variables.

Not what you are looking for ? Make a new search !


Leave a Reply

Notify of