Hello,
I cannot reproduce the error:
> library(ggplot2)
Attaching package: 'ggplot2'
The following object(s) are masked from 'package:latticeExtra':
layer
> library(cshapes)
Loading required package: maptools
Loading required package: foreign
Checking rgeos availability: TRUE
Loading required package: rJava
Warning: replacing previous import 'show' when loading 'rJava'
> 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)))
Regions defined for each Polygons
> ggplot()+map_mp
Here are the some details of my configuration:
R version 2.15.2 (2012-10-26)
|- ggplot2_0.9.3
\- cshapes_0.3-2
|- maptools_0.8-20
|- foreign_0.8-51
\- rJava_0.9-3
HTH
Pascal
Le 12/12/2012 21:27, Vasilchenko Aleksander a ?crit :> 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?
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>