교육용 프로그래밍 Home Work 1
2020-09-28
Chapter1 Problem 1
Using the mpg dataset in the ggplot2 package, replicate the plot below using the following settings:
- Set alpha = 0.5 for the width of bars
- Use theme_minimal()
Answer
library(ggplot2)
ggplot(data = mpg, aes(x = hwy, fill = drv)) +
geom_histogram(alpha=0.5) +
labs(title = "Histogram",
subtitle = "Histogram of Highway Mile Per Gallon",
caption = "source: mpg"
) +
theme_minimal()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.