To draw a scatter plot of the electricity consumption per capita against the GDP per capita, and then fit a regression model. Let's begin by implementing the following steps:
- Use ggplot and specify the x and y aesthetics, as follows:
X=gdp_per_capita, Y=Electricity_consumption_per_capita
- Make a scatter plot using geom_point. The points should be color differentiated by country (aes(color=Country) ).
- Set the appropriate x-axis limits (from 0-3,000).
- Add a linear regression model, stat_smooth (method=lm).