Quantcast
Channel: Easy Guides
Viewing all articles
Browse latest Browse all 183

ggsave : Save a ggplot - R software and data visualization

$
0
0


ggsave: save the last ggplot

ggsave is a convenient function for saving the last plot that you displayed. It also guesses the type of graphics device from the extension. This means the only argument you need to supply is the filename.

It’s also possible to make a ggplot and to save it from the screen using the function ggsave():

# 1. Create a plot
# The plot is displayed on the screen
ggplot(mtcars, aes(wt, mpg)) + geom_point()

# 2. Save the plot to a pdf
ggsave("myplot.pdf")

For saving to a png file, use:

ggsave("myplot.png")

Infos

This analysis has been performed using R software (ver. 3.2.1) and ggplot2 (ver. )


Viewing all articles
Browse latest Browse all 183

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>