Something similar like this How to save a plot as image on the disk? but I need also to adjust the plot size, so let's say the exported plot should have a width
of 1000 and a height
of 746. How can I predefine such size parameter in the code?
Asked
Active
Viewed 445 times
0

evian_bottle
- 67
- 7
-
`png(filename = "Rplot%03d.png", width = 480, height = 480, units = "px", pointsize = 12)` ... – D.J Mar 25 '21 at 11:07
1 Answers
1
R's graphics devices have width
and height
arguments, that can be set to specified values.
Here is an example with device png()
.
png(filename = "mtcars.png", width = 1000, height = 746)
plot(mpg ~ hp, mtcars)
abline(lm(mpg ~ hp, mtcars), col = "blue", lty = "dashed")
dev.off()

Rui Barradas
- 70,273
- 8
- 34
- 66