[R-sig-Geo] contourline as border between cells containing numbers and those containing NA of ASCII grid

Roger Bivand Roger.Bivand at nhh.no
Fri Jul 28 12:09:44 CEST 2006

On Fri, 28 Jul 2006, Jan Schwanbeck wrote:

> Hi R spatial experts,
>  From an ASCII grid I have made a couple of filled.contour - plots.
> All cells outside the area of interest are set to NA. The cells inside
> the area of investigation are numbers(real).
> In my plots - both NA's and values smaller than 0.5 are "transparent".
> To show the border of the area of investigation I would like to generate
> a contourline or something similar in between cells containing numbers and  
> those containing NA.
> Is there any possibile way to do that?
> If not: -> How could I overlay a filled.contour-plot with a shape file  
> (the border of the area)?

Have a look at the plot.axes= argument for how to insert extra graphics 
into the plot:

xx <- readShapePoly(system.file("shapes/sids.shp",
  package = "maptools")[1], IDvar = "FIPSNO",
  proj4string = CRS("+proj=longlat +ellps=clrk66"))
x <- seq(-85,-75,1)
y <- seq(33,37,1)
xy <- expand.grid(x,y)
z <- matrix(runif(55), nrow=11)
filled.contour(x, y, z, asp=1)
filled.contour(x, y, z, asp=1, plot.axes={axis(1); axis(2); plot(xx, 

does seem to work.


> Thanks a lot.
> Jan Schwanbeck
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

More information about the R-sig-Geo mailing list