在R图中的x轴下方添加箭头 [英] Adding an arrow below the x axis in R plots

查看:263
本文介绍了在R图中的x轴下方添加箭头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在R图中的x轴下方添加标记特定x坐标的箭头.我的x轴位于y = 0处,并且当我尝试在arrows中使用负y坐标时,箭头将垂直于x轴,因此仅绘制了箭头的边缘(尽管有些空间,例如e ,g绘制了x轴标签和刻度线的位置.

I am trying to add arrows marking specific x coordinates below the x axis in an R plot. My x axis is at y=0 and when I try to use negative y-coordinates in arrows, so the arrows will be perpendicular to x axis, I get only the very edges of the arrow plotted (although is some space, e,g where the x-axis label and tickmarks are plotted).

推荐答案

xpd选项可以在箭头中使用,因此您可以将坐标设置为绘图区域之外,并将xpd设置为TRUE.例如,假设xlim = c(0,10)和ylim =(0,10),然后将x轴设置为0,然后

The xpd option can be used in arrows so you can just set your coordinates to be outside your plot region and set xpd to TRUE. For example, assuming xlim = c(0,10) and ylim = (0,10), and you set the x-axis to 0 then

arrows(1.4, -1, 1.4, 0, xpd = TRUE)

在x轴上的那个位置1.4处绘制一个垂直的箭头.

draws a vertical arrow pointing up at the x-axis at position 1.4 on that axis.

这篇关于在R图中的x轴下方添加箭头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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