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

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

问题描述

我必须在R中绘制141个直方图.我正在使用Windows8.然后我写:

I have to plot 141 histograms in R. I am working with windows 8. then I write:

par(mfcol=c(12,12), oma=c(1,1,0,0))

for(m in 1:141 ){
  x <- precData[[m]]
  hist(x[x != 0],30, xlab=NA, ylab=NA, main=statData$Name[m])
}

但我总是收到此错误:plot.new()错误:图形边距太大

But always I get this error: Error in plot.new() : figure margins too large

我该如何解决? 有没有用于调整每个直方图大小的命令?

How can I solve it?? Is there any command for adjusting the size of each histogram??

谢谢.

推荐答案

您设置了外部边距(在整个图集的外部),但是内部边距(对于每个面板)是默认设置.由于页边距为默认值,因此每个面板中没有足够的空间来绘制直方图并具有页边信息.

You set the outer margins (outside the whole set of plots) but the inner margins (for each panel) are at the default. With the margins at the default, there is not enough room within each panel to plot the histogram and have the marginal information.

因此,您还需要更改内部边距,如果您希望任何东西看起来合理,那么还应该更改要添加的内容的大小和位置.

So you need to change the inner margins as well, and if you want anything to look reasonable then you should also change size and position of the things to be added.

这里是一个示例(由于您的示例不可复制,因此我不得不更改为随机数据):

Here is an example (I had to change to random data since your example was not reproducible):

par(mfcol=c(12,12), oma=c(1,1,0,0), mar=c(1,1,1,0), tcl=-0.1, mgp=c(0,0,0))

for(m in 1:141 ){
  x <- rnorm(100)
  hist(x[x != 0],30, xlab=NA, ylab=NA, main=paste('data: ',m), 
        cex.axis=0.5, font.main=1, cex.main=0.8)
}

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

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