frame() 错误:图边距太大 [英] Error in frame() : figure margins too large

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

问题描述

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

I am trying to create a matrix of plots, but I want the upper left corner to be blank. So I'm using:

frame()

R 响应:

frame() 中的错误:图形边距太大

Error in frame(): figure margins too large

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

I'm using the following two lines to create my layout:

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));

这给了我以下布局:

如果我然后发出 frame() 我得到上述错误.我究竟做错了什么?我看不到任何为 frame() 命令指定高度或宽度的方法(只是 plot.new() 的别名)?

If I then issue frame() I get the above error. What am I doing wrong? I don't see any way to specify a height or a width for the frame() command (just an alias for plot.new())?

推荐答案

该消息表示图中边距过大,没有为情节留出足够的空间.

The message means that the margins in the figure are too large and do not leave enough space for the plot.

尝试减少边距:

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() 开始,或者只是绘制到第一个面板中.请注意,您需要考虑每个不同面板的适当边距设置,并微调标签大小等.

You can start with frame() or plot.new(), or just plot into the first panel. Note you will need to consider what is an appropriate margin setting for each of your different panels, and fine-tune label sizes and so on.

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

For a totally blank panel, you might as well kill the margin completely:

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

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

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