error map with ggplot2

22 views
Skip to first unread message

r tremeaud

unread,
Sep 29, 2011, 7:42:23 AM9/29/11
to ggplot2
i'm trying draw a map with ggplot2
Code:
suisse <- readShapePoly("/Users/raphaeltremeaud/Desktop/Rsig/data/
CHE_adm/CHE_adm1.shp",proj4string=CRS("+proj=longlat +datum=WGS84"))
Sys.setlocale("LC_ALL", locale="C")
suisse <- fortify.SpatialPolygonsDataFrame(suisse,region="NAME_1")

###using merge
Code:
'data.frame': 27 obs. of 2 variables:
$ dat : Factor w/ 27 levels "","Aargau","Appenzell Ausserrhoden",..:
1 2 3 4 5 6 7 8 9 10 ...
$ Freq: int 1 29 10 1 20 28 108 14 27 2 ...
suisse.fusion <- merge(suisse,dat, by.x = "id", by.y = "dat")
suisse.fusion <- suisse.fusion[order(suisse.fusion$order), ]

when i draw using ggplot2 there is an error message "state of graphics
wrong"
Code:
ggplot(suisse.fusion, aes(long, lat)) +
geom_polygon(aes(group=id, fill = Freq))

#####here is my problems
Erreur dans recordGraphics(drawGTree(x), list(x = x),
getNamespace("grid")) :
'etat des graphiques incorrect###<- "state of graphics wrong"
what does it mean ?
think you

Hadley Wickham

unread,
Oct 4, 2011, 11:14:34 AM10/4/11
to r tremeaud, ggplot2
You're more likely to get a response if you provide a reproducible
example (https://github.com/hadley/devtools/wiki/Reproducibility)

Hadley

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>

--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

Reply all
Reply to author
Forward
0 new messages