Skip to content
This repository

Coord_map() and annotation_map does not work. #568

Closed
PhilDon opened this Issue · 3 comments

2 participants

Phil Donovan Winston Chang
Phil Donovan
PhilDon commented

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".

Winston Chang
Collaborator
wch commented

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

Phil Donovan
PhilDon commented

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.

Winston Chang wch referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Winston Chang
Collaborator
wch commented

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

Winston Chang wch closed this in aa29fc2
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.