How to save ggplots?

0 votes
How to save plots made using ggplot?
Jul 15 in Data Analytics by lakshmi
17 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
• 19,510 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,700 points
335 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,186 views
0 votes
0 answers

How to save datasets in R as external file?

How to save datasets in R as ...READ MORE

Aug 6 in Data Analytics by kavya
8 views
0 votes
0 answers

How to add 2 ggplots side by side?

How to add 2 ggplots side by ...READ MORE

1 day ago in Data Analytics by karthick
4 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,280 points
72 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,280 points
63 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,280 points
111 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,530 points
53 views
0 votes
2 answers

How to sum a variable by group in R?

You can also try this way, x_new = ...READ MORE

answered Jul 31 in Data Analytics by Cherukuri
• 19,510 points
6,185 views
0 votes
4 answers

How to remove NA values from a Vector in R?

You can try na.omit() or na.exclude() too. ...READ MORE

answered Jul 31 in Data Analytics by anonymous
• 19,510 points
5,255 views