[R-sig-Geo] How to draw grid contours within a map

Thiago Veloso thi_veloso at yahoo.com.br
Wed Feb 16 18:57:46 CET 2011

```  Robert and Lyndon,

Thank you very much. With little effort, both approaches worked flawlessly.

Best,

Thiago.
--- On Tue, 15/2/11, Robert Hijmans <r.hijmans at gmail.com> wrote:

> From: Robert Hijmans <r.hijmans at gmail.com>
> Subject: Re: [R-sig-Geo] How to draw grid contours within a map
> To: r-sig-geo at stat.math.ethz.ch
> Date: Tuesday, 15 February, 2011, 16:05
>
> >  In order to illustrate the spatial domain of the
> General Circulation Model
> (GCM) output data I am using, I
> > need to display some grids within a map. They need to
> be 2.5°x2.5° lat-lon
> > over specific coordinates.
>
> >  Following, I create the "empty" grids to draw:
>
> >library(raster)
> >rprecip<-raster(xmn=-60,xmx=-50,ymn=-35,ymx=-25)
> >res(rprecip)<-2.5
>
> Thiago,
>
> You can do this
>
> rprecip[] <- 1
> # (set cells you do not want to NA)
> p <- rasterToPolygons(res)
> plot(p)
>
> Robert
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/How-to-draw-grid-contours-within-a-map-tp6027387p6028652.html
> Sent from the R-sig-geo mailing list archive at
> Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

```

More information about the R-sig-Geo mailing list