We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d8629c commit e70fb93Copy full SHA for e70fb93
R/geom-polygon.r
@@ -59,11 +59,22 @@ GeomPolygon <- proto(Geom, {
59
n <- nrow(data)
60
if (n == 1) return()
61
62
+ munched <- coord_munch(coordinates, data, scales)
63
+
64
+ # For gpar(), there is one entry per polygon (not one entry per point).
65
+ # We'll pull the first value from each group, and assume all these values
66
+ # are the same within each group.
67
+ first_idx <- !duplicated(munched$group)
68
+ first_rows <- munched[first_idx, ]
69
70
ggname(.$my_name(), gTree(children = gList(
- with(coord_munch(coordinates,data, scales),
- polygonGrob(x, y, default.units = "native", id = group,
- gp = gpar(col = colour, fill = alpha(fill, alpha),
- lwd = size * .pt, lty = linetype)
71
+ polygonGrob(munched$x, munched$y, default.units = "native",
72
+ id = munched$group,
73
+ gp = gpar(
74
+ col = first_rows$colour,
75
+ fill = alpha(first_rows$fill, first_rows$alpha),
76
+ lwd = first_rows$size * .pt,
77
+ lty = first_rows$linetype
78
)
79
80
)))
0 commit comments