Aside from faceting, we can also produce a color differentiated plot. It can be advantageous to use a color differentiated plot when the shapes are very similar and there is some overlap. To see small differences, it is useful to use colors. For example, we can plot the Electricity consumption versus GDP by using different colors or shapes for the countries.
Changing Styles and Colors
Using Different Colors to Group Points by a Variable
In this section, we'll produce a color differentiated scatter plot with respect to a third variable. Let's begin by implementing the following steps:
- Choose a subset of dataset 1 (gapminder) and select a few countries. Use the following subset command:
dfs <- subset(df,Country...