Facets

In data visualization, we sometimes have the need to compare different groups, looking at data alongside each other. One method for doing this is creating a subplot for each group. These kinds of plots are known as Trellis displays. In ggplot2, they're called facets. Facets divide the data by some discrete or categorical variable and display the same type of graph for each data subset.

Let's look at electricity consumption versus GDP for different countries, which we calculated in the previous activity.

We don't know which country has the highest GDP or electricity consumption. Let's split the data now.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.103.8