[R] Problems with plot maps

Vasilchenko Aleksander vasilchenko.a.p at gmail.com
Wed Dec 12 13:27:38 CET 2012


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?



More information about the R-help mailing list