Closed iago-pssjd closed 3 years ago
Could you provide an image or example code of what you want to fill with a pattern?
As I understand it, a 'linerange' is a line object, and thus doesn't really have an area to fill.
Yes, you are right, I was thinking in linerange
with enough size so it has width.
df <- data.frame(
trt = factor(c(1, 1, 2, 2)),
resp = c(1, 5, 3, 4),
group = factor(c(1, 2, 1, 2)),
upper = c(1.1, 5.3, 3.3, 4.2),
lower = c(0.8, 4.6, 2.4, 3.6)
)
p <- ggplot(df, aes(trt, resp, colour = group))
p + geom_linerange(aes(ymin = lower, ymax = upper), size = 4)
My issue was motivated by the desire of filling the patterns of lines in an image like the one below in order to distinguish both groups in a white and black image (and yes, i know I can do it by means of different levels of gray, which was my final solution).
Ah I see what you want, but this is not possible with ggpattern.
ggpattern will fill areas, but thick lines are not geometrically an area, and there is no current way to fill them.
I was looking for filling a plot with patterns and I found this great package. Unfortunately, I need fill the patterns on
geom_linerange
andggstance::geom_linerangeh
not covered by it. But I believe that when this package cover all the geoms, at least fromggplot
, it will be very relevant.Thank you!