Skip to content

Coord_map() and annotation_map does not work. #568

Closed
PhilDon opened this Issue May 31, 2012 · 3 comments

2 participants

@PhilDon
PhilDon commented May 31, 2012

This looks to be the same bug as Issue#480. Copying Hadley's code in 480:

library(ggplot2)
library(reshape2) # for melt
crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
crimesm <- melt(crimes, id = 1)
states_map <- map_data("state")

ggplot(crimes, aes(map_id = state)) + geom_map(aes(fill = Murder), map = states_map) + expand_limits(x == states_map$long, y = states_map$lat) + annotation_map(states_map) + coord_map()

Gets the error "Error in validDetails.polygon(x) : 'x' and 'y' and 'id' must all be same length".

@wch
Collaborator
wch commented May 31, 2012

this should be fixed in 0.9.1. Are you using that version?

@PhilDon
PhilDon commented May 31, 2012

I downloaded and installed the new package today so I presume it is the latest and greatest. When I tried Hadley's original code with just geom_map() and coord_map() it worked. But when I added annotation_map() (see code) it failed with the original error for Issue#480.

@wch
Collaborator
wch commented May 31, 2012

Got it. I've submitted a pull request for a fix.

@wch wch added a commit to wch/ggplot2 that referenced this issue Jun 5, 2012
@wch wch annotation_map: get group id from munched data (Fixes #568) fc6cf35
@wch wch closed this in aa29fc2 Jun 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.