This type of plot might have a different name, if so kindly point me to a relevant post.
I am trying to plot simple "comb" plot using 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)
It seems, so many lines of code for a simple plot, is there other ggplot
function I am missing?
Dunno about ggplot, but why not use
graphics::rug
?