Save a ggplot (or other grid object) with sensible defaults — ggsave • ggplot2
Description
ggsave() is a convenient function for saving a plot. It defaults to
saving the last plot that you displayed, using the size of the current
graphics device. It also guesses the type of graphics device from the
extension.