Chapter4 Problem 4
Using the iris dataset in the datasets package (dataset package belongs to Base R and so you don’t need to download the package), replicate the plot below using the following settings:
- Set size = 6 for the size of points
- Set alpha = 0.5
- Use theme_minimal()
(iris is another famous dataset in R. You may google or check the this link to learn more about the dataset)
Answer
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, color=Species, shape=Species)) +
geom_point(size=6, alpha = 0.5) +
labs(title = "Scatterplot",
subtitle = "Sepal.Length Vs Sepal.Width",
caption = "source: iris"
) +
theme_minimal()