"plot.new()中的错误:图形边距太大" [英] "Error in plot.new() : figure margins too large"

查看:95
本文介绍了"plot.new()中的错误:图形边距太大"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在R中,遇到如下运行错误:

In R, I met a running error as follows:

> png("p3_sa_para.png", 4, 2)
> par(mfrow=c(1,2))
> plot(c(1:10), ylab="Beta",xlab="Iteration")
Error in plot.new() : figure margins too large
> plot(c(1:10), ylab="Gamma",xlab="Iteration")
Error in plot.new() : figure margins too large
> dev.off()
X11cairo 
       2 

我已经将图像尺寸缩小为4乘2,为什么它仍然抱怨图边距太大"?如何使用png解决此问题?

I have already made the image size small to be 4 by 2, why it still complains "figure margins too large"? How can I solve this problem with png?

奇怪的是,如果我将png更改为pdf,那么它将起作用.我也想知道为什么吗?

It is strange that if I change png to pdf, then it will work. I also wonder why?

感谢和问候!

推荐答案

png()函数使用的是像素而不是英寸,因此请尝试使用类似的

The png() function uses pixels not inches, so try something like

png("p3_sa_para.png", 640, 480)

回答第二个问题,是的,pdf()使用英寸,因为矢量图形格式没有像素的概念. help(png)help(pdf)功能是您的朋友.

And to answer your second question, yes, pdf() uses inches because a vector-graphics format has no notion of pixels. The help(png) and help(pdf) functions are your friends.

这篇关于"plot.new()中的错误:图形边距太大"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆