问题描述
我正在尝试在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轴下方添加箭头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!