I would like to create a function to save plots (from ggplot
).
Here is a data frame:
### creating data frame
music <- c(\"Blues\", \"Hip-
Following was useful for me, may be for someone else as well. One can save the last plot without explicitly referring it as well.
ggsave("filename.pdf", # jpg, png, eps, tex, etc.
plot = last_plot(), # or an explicit ggplot object name,
width = 7, height = 5,
units = "in", # other options c("in", "cm", "mm"),
dpi = 300)