如何在 R 中的绘图区域之外画一条线或添加文本?

发布于 2024-09-16 09:57:50 字数 219 浏览 7 评论 0原文

感谢您的阅读。我发现我无法在绘图区域之外绘制线/点或添加文本。如果我从绘图内部(轴内)区域到 xlab 主标题区域绘制一条线,则仅显示绘图内的部分。在多重绘图 (mfrow) 中,线/点只会在最后一个活动绘图内绘制。

plot(0);
l=locator(2,type='n');
lines(l, type='l'); 

有什么办法解决这个问题吗?谢谢!

Thank you for reading. I find that I am unable to draw lines/points or add text outside of the plot area. If I draw a line from inside the plot (within the axis) area to the area of the xlab main title areas only the part within the plot shows. In a multiple plot graph (mfrow) the line/point will only be drawn inside the last active plot.

plot(0);
l=locator(2,type='n');
lines(l, type='l'); 

Any solution to this problem? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青萝楚歌 2024-09-23 09:57:50

xpd 参数控制可以绘制的位置。使用 par()$xpd 检查当前值,然后尝试设置 par(xpd=NA)。

来自 par 帮助:

 ‘xpd’ A logical value or ‘NA’.  If ‘FALSE’, all plotting is
      clipped to the plot region, if ‘TRUE’, all plotting is
      clipped to the figure region, and if ‘NA’, all plotting is
      clipped to the device region. See also ‘clip’.

The xpd parameter controls where you can draw. Check the current value with par()$xpd and then try setting par(xpd=NA).

From the par help:

 ‘xpd’ A logical value or ‘NA’.  If ‘FALSE’, all plotting is
      clipped to the plot region, if ‘TRUE’, all plotting is
      clipped to the figure region, and if ‘NA’, all plotting is
      clipped to the device region. See also ‘clip’.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文