I'm plotting several segments as once using ggplot2, with two different sizes.
An example of what I want to do is provided in one of the answers here. Here's the example they provide:
ggplot2::ggplot() +
geom_segment(data = df[df$type=="A", ], aes(colour = type, x = x1, xend = x2, y = id, yend = id), size = 12)+
geom_segment(data = df[df$type=="B", ], aes(colour = type, x = x1, xend = x2, y = id, yend = id), size = 6)
The output being:
My question is: how can I make the legend items have the same size? As provided in the answer I mention on the post, but I don't know how it turned out like this:
Any help or other suggestions are appreciated!


where