I did something like this with my data, but despite the transparency the segments are hard to visualise (my data has lot less number of segments than the example below) to see their beginning and end.
require(ggplot2)
ggplot(iris, aes(x = Petal.Length, xend = Petal.Width,
y = factor(Species), yend = factor(Species),
size = Sepal.Length)) +
geom_segment(alpha = 0.05) +
geom_point(aes(shape = Species))
Came across this solution, but the lines are criss-crossed. Is there a way to make the jitter produce parallell lines with the points at the tips? I have tried position_dodge
instead of position_jitter
, but it requires ymax
. Can ymax
be integrated at all for use with geom_segment
?
ggplot(iris, aes(x = Petal.Length, xend = Petal.Width,
y = factor(Species), yend = factor(Species))) +
geom_segment(position = position_jitter(height = 0.25))+
geom_point(aes(size = Sepal.Length, shape = Species))