将mtcars
数据集和plot
函数与参数type= 'h'
一起使用,我只想用mtcars$wt >4
标记观察值,但没有进行管理。我尝试过:
plot(mtcars$wt,type = 'h',ylim = c(0,6))
abline(h=4)
text(mtcars$wt,row.names(mtcars[mtcars$wt >4,]),pos =3,col='blue',cex=0.6))
但是所有酒吧都被贴上标签:
我也尝试了Add labels to plot for specific values in R提供的解决方案,但没有设法使它起作用。
如果标签也可以以45度角也位于条形图的顶部,以避免重叠,那就太好了>>
使用参数类型为'h'的mtcars数据集和绘图函数,我只想将mtcars $ wt> 4标记为观察值,但没有进行管理。我试过了:plot(mtcars $ wt,type ='h',ylim = c(0,...
可能有几种解决方法。我试过了: