How to save ggplots?

0 votes
How to save plots made using ggplot?
Jul 15 in Data Analytics by lakshmi
29 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 by anonymous
• 28,360 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
516 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,690 points
1,544 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 in Data Analytics by kamal
17 views
0 votes
0 answers

How to save leaflet object as an image?

How to save leaflet object as an ...READ MORE

Sep 19 in Data Analytics by anonymous
• 28,360 points
20 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,270 points
150 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,270 points
72 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 in Data Analytics by Tyrion anex
• 8,270 points
123 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 in Data Analytics by Sophie may
• 9,850 points
63 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 in Data Analytics by anonymous
• 28,360 points
13 views
0 votes
2 answers

How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE

answered Aug 21 in Data Analytics by anonymous
• 28,360 points
138 views