Created
April 26, 2019 03:27
-
-
Save dgkeyes/69d82068dbb7694a2f40094ebd164142 to your computer and use it in GitHub Desktop.
color and fill solutions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `color` and `fill` | |
Take your graph from above (the one with `geom_col`) and make the inside of each bar a different color. | |
```{r} | |
ggplot(data = sleep_by_gender, | |
mapping = aes(x = gender, | |
y = avg_sleep, | |
fill = gender)) + | |
geom_col() | |
``` | |
Make your scatterplot from before that shows weight on the x axis and height on the y axis again, but make the dots show up in different colors based on the `phys_active` variable. | |
```{r} | |
ggplot(data = nhanes, | |
mapping = aes(x = weight, | |
y = height, | |
color = phys_active)) + | |
geom_point() | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment