Skip to content
Prev 313470 / 398502 Next

Problems with plot maps

Hello,
I need plot map using ggplot()
I use such code:

library("ggplot2")
library(cshapes)
cshp.data <- cshp()
map <- cshp.data[cshp.data$COWCODE==369,]
map_mp<- list(
    geom_polygon(aes(long, lat, group = group), data = map, fill = "grey70",
                 colour = "grey60", inherit.aes = FALSE, show_guide = FALSE),
    scale_x_continuous("", breaks = NULL, expand = c(0.02, 0)),
    scale_y_continuous("", breaks = NULL, expand = c(0.02, 0)))

ggplot()+map_mp

but I have such error
"Error in recordGraphics(drawGTree(x), list(x = x), getNamespace("grid")) :
  invalid graphics state"

What am I doing wrong?