## Not run:
# ggplot(mtcars, aes(mpg, wt)) + geom_point()
#
# ggsave("mtcars.pdf")
# ggsave("mtcars.png")
#
# ggsave("mtcars.pdf", width = 4, height = 4)
# ggsave("mtcars.pdf", width = 20, height = 20, units = "cm")
#
# unlink("mtcars.pdf")
# unlink("mtcars.png")
#
# # specify device when saving to a file with unknown extension
# # (for example a server supplied temporary file)
# file <- tempfile()
# ggsave(file, device = "pdf")
# unlink(file)
# ## End(Not run)
Run the code above in your browser using DataLab