如何调整尺寸并将其保存为png格式? [英] How to resize and save plots in png format?
本文介绍了如何调整尺寸并将其保存为png格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想绘制分位数回归的结果,但不能:
I would like to plot the results from a quantile regression, but am not able to:
- 控制地块的尺寸/大小,并
- 将图另存为png.
这是我的代码:
require(quantreg)
data(engel)
attach(engel)
xx <- income - mean(income)
zz <- c(120, diff(income))
fit1 <- summary(rq(foodexp~xx+zz, tau=2:98/100))
然后:
png('res.png')
plot(fit1, mfrow=c(1,2))
仅将zz绘图保存到res.png文件中.有什么方法可以将绘图保存到单独的文件中(两个和一个)? 以及如何控制图的宽度/高度?我喜欢将所有单个图保存到.png文件时都具有width = height(正方形)吗?
Only the zz plot is saved to the res.png file.. Is there any way I can save the plots in separate files (two and one)? and how do I control the width/height of the plots? I like all the individual plots to have width=height (square) when i save them to the .png file?
推荐答案
您可以通过png
参数控制图像尺寸.
You can control the image dimensions by png
argument.
png("image.png", width = 800, height = 600)
plot(...)
dev.off()
要修饰"图像,请使用dev.off
.
To "finish" the image, use dev.off
.
这篇关于如何调整尺寸并将其保存为png格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文