Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

R code in R-Studio to save the graph as .jpeg or .png

When I used R , there a graph could be saved by going to file as click save as then .jpeg .

But , I am unable to save like that in R studio . So , I searched but was unable to get a code to save the graph as .jpeg or .png .

Can anyone please help and provide with the code for it ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

It would be a great help .
Thank You

>Solution :

With ggplot you can use the function ggsave()

library(ggplot)

df = iris

ggplot(data=df, aes(x=Species, y=Sepal.Width)) + geom_point(aes(color=Species, shape=Species))

ggsave("iris.png", width = 4, height = 4, dpi=300)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading