How to save ggplots

0 votes
How to save plots made using ggplot?
Jul 15, 2019 in Data Analytics by lakshmi
1,032 views

1 answer to this question.

0 votes

Hi you can save plots using ggsave()

Code to save ggplot in your system.

ggsave("image_name.png",plot_object, [width], [Hieght])

Height and width are optional and can be provided to give image properties.

Plot object is the R variable that holds the plot such as line below.

line = ggplot(mpg, aes(displ)) + geom_point()

The other way is to use png() function as explained here.

https://www.edureka.co/community/1349/save-a-plot-as-image-on-the-disk-using-r?show=1349#q1349

answered Jul 15, 2019 by anonymous
• 33,030 points

Related Questions In Data Analytics

0 votes
1 answer

How to save a DataFrame in R??

Suppose your DataFrame is named as df: write.csv(df,file="exmp.csv") Then ...READ MORE

answered Apr 20, 2018 in Data Analytics by DeepCoder786
• 1,720 points
5,170 views
0 votes
1 answer

How can I save grid.arrange() plot to file ?

grid.arrange() directly draws on our device. However, ...READ MORE

answered May 16, 2018 in Data Analytics by zombie
• 3,790 points
6,940 views
0 votes
1 answer

How to save datasets in R as external file?

One way is to save the data ...READ MORE

answered Sep 10, 2019 in Data Analytics by kamal
1,158 views
0 votes
1 answer

How to arrange ggplots in custom order?

You can arrange a ggplot by using ...READ MORE

answered Oct 29, 2019 in Data Analytics by Cherukuri
• 33,030 points
1,202 views
0 votes
1 answer

R programming: How to compute Euler's number?

The following R statement exp(1) indicates e, and exp(2) represents e^2. This ...READ MORE

answered Dec 28, 2018 by Tyrion anex
• 8,700 points
1,518 views
0 votes
1 answer

R programming: How to pass variables from a r program to mysql function?

To include the R variables called start.date and end.date, you can use paste to ...READ MORE

answered Dec 28, 2018 in Data Analytics by Tyrion anex
• 8,700 points
1,333 views
0 votes
1 answer

R Programming: Implement Newton Raphson Algorithm

The problem is that the expressions for f and f1 ...READ MORE

answered Jan 7, 2019 in Data Analytics by Tyrion anex
• 8,700 points
1,602 views
0 votes
1 answer

R programming: Flip coin simulation

Make use of the ggplot2 package. Start by installing and ...READ MORE

answered Jan 21, 2019 in Data Analytics by Sophie may
• 10,620 points
1,248 views
0 votes
1 answer

How to add 2 ggplots side by side?

Hi, Use ggarrange() function to show multiple ggplot in ...READ MORE

answered Aug 19, 2019 in Data Analytics by anonymous
• 33,030 points
2,109 views
0 votes
1 answer

How to save leaflet object as an image?

Yes, you can save leaflet objects as ...READ MORE

answered Oct 28, 2019 in Data Analytics by Cherukuri
• 33,030 points
5,506 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP