【问题标题】:Multiple plots in one figure in R: Error if only ONE columnR中一个图中的多个图:如果只有一列则错误
【发布时间】:2015-05-09 22:17:01
【问题描述】:

我正在尝试使用 R / RStudio 将多个图形合并为一个。它在绘制 2 x 2、3 x 5 等时工作正常。除了绘制 ONE 列之外,它适用于所有组合。如果我尝试使用an example of the rather renomated help site statmethods.net 绘制一列

# 3 figures arranged in 3 rows and 1 column
attach(mtcars)
par(mfrow=c(3,1))
hist(wt)
hist(mpg)
hist(disp)

我在第二个情节之后立即收到消息:

hist(mpg)

Error in plot.new() : figure margins too large

有人遇到过同样的问题吗?

【问题讨论】:

    标签: r plot rstudio


    【解决方案1】:

    如果绘图窗口的大小对于您要绘制的内容来说太小,RStudio 将抛出该错误。您可以尝试将绘图窗口相对于控制台等拖得更大,或者您可以将绘图直接写入文件,例如使用pdf() 和dev.off()。

    【讨论】:

    • 啊,有道理!我正在使用 11" 屏幕。我永远不会看到物理窗口大小是问题的根源!非常感谢您的快速回答!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-29
    • 1970-01-01
    • 2014-07-02
    相关资源
    最近更新 更多