Permalink
Browse files

annotation_map: get group id from munched data (Fixes #568)

  • Loading branch information...
1 parent c97be66 commit aa29fc288c175042050b93a998c8a637c567a3d1 @wch wch committed May 31, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 R/annotation-map.r
View
@@ -41,10 +41,14 @@ GeomAnnotationMap <- proto(GeomMap, {
objname <- "map"
draw_groups <- function(., data, scales, coordinates, map, ...) {
+ # Munch, then set up id variable for polygonGrob -
+ # must be sequential integers
coords <- coord_munch(coordinates, map, scales)
- id <- match(map$group, unique(map$group))
-
- polygonGrob(coords$x, coords$y, default.units = "native", id = id,
+ coords$group <- coords$group %||% coords$id
+ grob_id <- match(coords$group, unique(coords$group))
+
+ polygonGrob(coords$x, coords$y, default.units = "native",
+ id = grob_id,
gp = gpar(
col = data$colour, fill = alpha(data$fill, data$alpha),
lwd = data$size * .pt))

0 comments on commit aa29fc2

Please sign in to comment.