Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ggplot2 Essentials

You're reading from   ggplot2 Essentials Explore the full range of ggplot2 plotting capabilities to create meaningful and spectacular graphs

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781785283529
Length 234 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Donato Teutonico Donato Teutonico
Author Profile Icon Donato Teutonico
Donato Teutonico
Arrow right icon
View More author details
Toc

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, if you already have a file with the same name, it will be overwritten without any warnings from R, so if you run the code in these examples, just verify that your working directory does not contain files with the same name as the plot that we will...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image