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 ?
It would be a great help . Thank You
CodePudding user response:
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)