Closed eliocamp closed 2 years ago
Chainging this line
to
first_idx <- !duplicated(interaction(munched$group, munched$subgroup))
to
polygons <- split(munched, interaction(munched$group, munched$subgroup))
Seems to work a lot better in my example case.
To this:
geom_polygon()
(not geom_pattern_polygon()
) call with holes? #44 Minimal reproducible example with holes:
# example modified from {ggplot2} unit tests
tbl <- data.frame(
x = c(
0, 10, 10, 0,
20, 30, 30, 20,
22, 28, 28, 22
),
y = c(
0, 0, 10, 10,
20, 20, 30, 30,
22, 22, 28, 28
),
group = c(rep(1, 4), rep(2, 8)),
subgroup = c(rep(1, 8), rep(2, 4))
)
p <- ggplot(tbl, aes(x, y, group = group, subgroup = subgroup)) +
geom_polygon_pattern(fill="lightblue", color="black")
I want to use ggpatern to hatch areas of a field with values greater (or lower) than some reference value using contours. However, this doesn't work well because of the lack of support for polygons with holes.
This would be a killer feature for me. Will it be implemented in the near future? If you know where in the code it should be implemented, Id' be happy to give it a try.