O'Reilly logo

ggplot2 Essentials by Donato Teutonico

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Saving plots to a file

In this section, we will take a look at the different methods available of saving your plots. Most of these concepts apply to all plots realized in R although we will also consider the ggsave() function that is specific to the ggplot2() package. In R, there are three ways that you can use to save created plots:

  • Saving the plot manually by way of the device window system (could be different between operating systems)
  • Saving the plot to a file without rendering the plot
  • Saving the plot after rendering the plot

We will take a look at the different methods in the upcoming sections. Just keep in mind that when you save a file as a plot, the file with the specified filename will be saved in your working directory. Be careful since, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required