I successfully create a plot using the following:
# suppose I have a p <- ggplot(data=df, ...) then the following works
# I get those two segments plotted correctly
p <- p + geom_segment(aes(x=1,y=103,xend=1,yend=107))
p <- p + geom_segment(aes(x=5,y=103,xend=5,yend=107))
However if I do:
values <- c(1, 5)
for (i in values) {
p <- p + geom_segment(aes(x=i,y=103,xend=i,yend=107))
}
It doesn't work, only the last segment is created. Can anyone advice what's wrong here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…