You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to tell `ggplot` how we want to visually represent the data, which we
81
-
do by adding a new **geom** layer. In our example, we used `geom_point`, which
82
-
tells `ggplot` we want to visually represent the relationship between **x** and
83
-
**y** as a scatterplot of points:
85
+
Here we told `ggplot` we want to plot the "gdpPercap" column of the
86
+
gapminder data frame on the x-axis, and the "lifeExp" column on the
87
+
y-axis. Notice that we didn't need to explicitly pass `aes` these
88
+
columns (e.g. `x = gapminder[, "gdpPercap"]`), this is because
89
+
`ggplot` is smart enough to know to look in the **data** for that column!
90
+
91
+
The final part of making our plot is to tell `ggplot` how we want to
92
+
visually represent the data. We do this by adding a new **layer**
93
+
to the plot using one of the **geom** functions.
84
94
85
-
```{r lifeExp-vs-gdpPercap-scatter2, fig.alt = "Scatter plot of life expectancy vs GDP per capita, showing a positive correlation between the two variables with data points added."}
95
+
```{r lifeExp-vs-gdpPercap-scatter, message=FALSE, fig.alt = "Scatter plot of life expectancy vs GDP per capita, now showing the data points."}
0 commit comments