+1 vote
2 views
in R Programming by (3.5k points)
edited by
I am ploating  simple linear regression plot in R and I want to save it as JPEG or PNG file, How can I do this using code?

Can I do it without generating the code and directly save it to my disk?

I also want to save the plot that I am seeing on my computer screen at it is, Is it possible?

1 Answer

0 votes
by (38.8k points)

If you want to save a plot, in R programming, then you need to perform the following steps:

  1. First, open a file, using png() or bmp() or pdf() format.
  2. Plot your model
  3. Close the file using dev.off()

The following is an example code that can be implemented for saving the plot to a png file:

fit <- lm(some ~ model)

png(filename="your/file/location/name.png")

plot(fit)

dev.off()

Related questions

+1 vote
1 answer
asked May 23, 2019 in R Programming by Ritik (3.5k points)
0 votes
1 answer
asked Jun 18, 2019 in R Programming by Shubham (3.9k points)
0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...