将绘图导出到具有预定义大小的磁盘,R
Export plot to disk with predefined size, R
类似这样的东西 How to save a plot as image on the disk? 但我还需要调整绘图大小,所以假设导出的绘图应该有 1000 的 width
和 746 的 height
。如何在代码中预定义这样的大小参数?
R 的图形设备有 width
和 height
个参数,可以设置为指定的值。
这是设备 png()
.
的示例
png(filename = "mtcars.png", width = 1000, height = 746)
plot(mpg ~ hp, mtcars)
abline(lm(mpg ~ hp, mtcars), col = "blue", lty = "dashed")
dev.off()
类似这样的东西 How to save a plot as image on the disk? 但我还需要调整绘图大小,所以假设导出的绘图应该有 1000 的 width
和 746 的 height
。如何在代码中预定义这样的大小参数?
R 的图形设备有 width
和 height
个参数,可以设置为指定的值。
这是设备 png()
.
png(filename = "mtcars.png", width = 1000, height = 746)
plot(mpg ~ hp, mtcars)
abline(lm(mpg ~ hp, mtcars), col = "blue", lty = "dashed")
dev.off()