如何在R中的绘图区域之外绘制线条或添加文本? [英] How to draw a line or add a text outside of the plot area in R?

查看:423
本文介绍了如何在R中的绘图区域之外绘制线条或添加文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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!

推荐答案

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

The xpd parameter controls where you can draw. Check the current value with par()$xpd and then try setting 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’.

这篇关于如何在R中的绘图区域之外绘制线条或添加文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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