Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 在图形上选择性地包含文本标签_R_Graph_Plot_Labels - Fatal编程技术网

R 在图形上选择性地包含文本标签

R 在图形上选择性地包含文本标签,r,graph,plot,labels,R,Graph,Plot,Labels,我绘制以下数据帧(x): 并使用 plot(x$S1, type="h") text(x$S1) 但是,我只希望表中高于阈值的值的文本。因此,我做了以下工作: plot(x$S1, type="h") y = x$S1 y[y<0.2] = NA text(y) 但是文本标签仍然显示递增的值,而不是x$Position的值。我尝试了很多方法来解决这个问题,但都没有成功 如何将x$Position值作为文本包含在图表上,但仅限于高于阈值的x$S1值?是否要这样做: plot(x$Posi

我绘制以下数据帧(
x
):

并使用

plot(x$S1, type="h")
text(x$S1)
但是,我只希望表中高于阈值的值的文本。因此,我做了以下工作:

plot(x$S1, type="h")
y = x$S1
y[y<0.2] = NA
text(y)
但是文本标签仍然显示递增的值,而不是
x$Position
的值。我尝试了很多方法来解决这个问题,但都没有成功

如何将
x$Position
值作为文本包含在图表上,但仅限于高于阈值的
x$S1
值?

是否要这样做:

plot(x$Position, x$S1, type="h")
text(x$Position,y,labels=x$Position)
plot(x$Position, x$S1, type="h")
plot(x$Position, x$S1, type="h")
text(x$Position,y,labels=x$Position)