[R] how to add a box to map plotted by a levelplot?
Jonsson
amen.alyaari at Bordeaux.inra.fr
Tue Sep 24 10:24:40 CEST 2013
conne2 <- file("C:\\ome1440s.bin","rb")
bioms<- readBin(conne2, integer(), size=1, n=1440*720, signed=F)
library(raster)
library(rasterVis)
data(wrld_simpl)
library(maptools) ## needed for wrld_simpl
r <- raster(nrow=720, ncol=1440)
r[] <- bioms; r <- ratify(r); rat <- levels(r)[[1]];
rat$soil <- LETTERS[1:13]; levels(r) <- rat
myPal <- c('gray80','gray80','blanchedalmond'
,'chartreuse','yellow','navajowhite2','salmon','lightskyblue','brown4','orange','burlywood4','palegreen','forestgreen')
levelplot(r, col.regions=myPal) +
layer(sp.polygons(wrld_simpl, lwd=0.5))
I want to add a box representing this zone of latitude and longtitude:
e6 <- extent( 2 , 8 , 45 , 51 )#erop
plot( e6 , add = TRUE )
but I got this
Error: invalid graphics state
Error: invalid graphics state
--
View this message in context: http://r.789695.n4.nabble.com/how-to-add-a-box-to-map-plotted-by-a-levelplot-tp4676815.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list