This type of plot may have a different name, if you so kindly point me to the appropriate post.
I am trying to build a simple "comb" chart with geom_segment():
require(ggplot2)
#dummy data
set.seed(1)
dat <- data.frame(x=sample(1:100,20))
#plot comb
ggplot(data=dat,
aes(x=x,y=0,xend=x, yend=10)) +
geom_segment() +
theme(panel.grid.major.x=element_blank(),
panel.grid.minor.x=element_blank(),
axis.title.x=element_blank()) +
#hide y ticks and label
scale_y_continuous(breaks=NULL) +
ylab(NULL)

There seem to be so many lines of code for a simple plot, is there any other function ggplotI am missing?
source
share