Hello,

One way is:
> levelplot(r, col.regions=myPal) +
> layer(sp.polygons(wrld_simpl, lwd=0.5)) +
> layer(panel.rect(2,45,8,51))

Regards,
Pascal



2013/9/24 Jonsson <amen.alya...@bordeaux.inra.fr>

> 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.
>
> ______________________________________________
> R-help@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.
>



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to