parent
8a43da7124
commit
2d0771ccd9
|
@ -236,8 +236,8 @@ One way to add additional variables is with aesthetics. Another way, particularl
|
||||||
To facet your plot by a single variable, use `facet_wrap()`. The first argument of `facet_wrap()` should be a formula, which you create with `~` followed by a variable name (here "formula" is the name of a data structure in R, not a synonym for "equation"). The variable that you pass to `facet_wrap()` should be discrete.
|
To facet your plot by a single variable, use `facet_wrap()`. The first argument of `facet_wrap()` should be a formula, which you create with `~` followed by a variable name (here "formula" is the name of a data structure in R, not a synonym for "equation"). The variable that you pass to `facet_wrap()` should be discrete.
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
|
ggplot(data = mpg) +
|
||||||
geom_point() +
|
geom_point(mapping = aes(x = displ, y = hwy)) +
|
||||||
facet_wrap(~ class, nrow = 2)
|
facet_wrap(~ class, nrow = 2)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue