I would like to have a needle plot like in
plot(1:10, 1:10, type = "h")
but in ggplot2. Is there a more or less direct way to do it? Or is that only possible with workarounds via line charts or something like that?

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

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With