2.7 Output- Saving Your Plots

View the iris dataset (first seen in Quiz 1.5) like a spreadsheet.

View(iris)


Use ggplot to create a scatter plot comparing the Petal.Length (x-axis) and Petal.Width (y-axis) of the flowers in the iris data. Save this scatter plot to a variable called p.

p = ggplot(iris, aes(Petal.Length, Petal.Width)) + geom_point()


Save the plot you just created to the file "petalsize.jpeg"

ggsave(p, filename="petalsize.jpeg")