gpt4 book ai didi

r - 帧()错误: figure margins too large

转载 作者:行者123 更新时间:2023-12-02 10:54:42 25 4
gpt4 key购买 nike

我正在尝试创建一个绘图矩阵,但我希望左上角为空白。所以我正在使用:

frame()

R 响应:

Error in frame(): figure margins too large

我使用以下两行来创建布局:

plotIDs <- matrix(c(1:16), 4, 4, byrow = T);
layout(plotIDs, widths = c(0.5,1,1,1,1), heights = c(0.5,1,1,1,1));

这给了我以下布局:

4 by 4 layout with first row and col at half height

如果我随后发出 frame() 我会收到上述错误。我究竟做错了什么?我没有看到任何方法来指定 frame() 命令的高度或宽度(只是 plot.new() 的别名)?

最佳答案

该消息表示图中的边距太大,没有为绘图留下足够的空间。

尝试减小边距:

op <- par(mar = par("mar")/2)
plot.new() ## this is optional for this example
plot(1:10)
par(op) ## tidy up to restore the default par setting

您可以从frame()或plot.new()开始,或者只绘制到第一个面板中。请注意,您需要考虑每个不同面板的适当边距设置,并微调标签尺寸等。

对于完全空白的面板,您不妨完全取消边距:

op <- par(mar = rep(0, 4))
plot.new()
par(op)

关于r - 帧()错误: figure margins too large,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6500697/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com