R ggplot2中的针形图

R ggplot2中的针形图,r,ggplot2,plot,R,Ggplot2,Plot,我想有一个针状图像在 plot(1:10, 1:10, type = "h") 但是在ggplot2中。有多少直接的方法可以做到这一点?还是只有通过折线图或类似的方法才能实现 library(ggplot2) ggplot(data.frame(x=1:10, y=1:10), aes(x=x, ymax=y, ymin=0)) + geom_linerange() 我在重复问题中使用了geom_段,你的稍微好一点。

我想有一个针状图像在

plot(1:10, 1:10, type = "h")
但是在
ggplot2
中。有多少直接的方法可以做到这一点?还是只有通过折线图或类似的方法才能实现

library(ggplot2)
ggplot(data.frame(x=1:10, y=1:10),
       aes(x=x, ymax=y, ymin=0)) +
  geom_linerange()


我在重复问题中使用了
geom_段
,你的稍微好一点。