[R] the proper way to use panel functions in lattice package?

From: simon chou <sentientc_at_gmail.com>
Date: Sat 11 Feb 2006 - 03:09:03 EST


Hi,
I was trying to stack a topographic map readed in from esri shapefile with a contour map and a vector map. However, the plotMap(maptools) and contourplot(lattice) do not seem to work well on top of each other. Here is part of my code.

      xrange<-range(225000:350000)

      yrange<-range(2685000:2810000)

      basemap <- read.shape("Twn25_town_dxf_Polygon.shp")

      plot.Map(basemap,xlim=xrange,ylim=yrange,fg=0,ol=8,xlab="",ylab="")

      contourplot(var1.pred~x+y, spcgrid, aspect = "xy",label.style="align")

I have tried to put panel function under plot.Map() but it gave some error message about some argoument matches other arguments.

>plot.Map

(basemap,xlim=xrange,ylim=yrange,fg=0,ol=8,xlab="",ylab="",panel=function(x,y){

      +contourplot(var1.pred~x+y, spcgrid, aspect = "xy",label.style= "align")})

      Error in plot.default(xylims$x,xylims$y, asp=1,type="n",...):

        argument 9 matches multiple formal arguments

I also tried to put plotMap() into contourplot()'s panel but plotMap cover up the conour. Maybe, there is something I miss in here.

What went wrong there? Also, is there any diffeence between contourplot(lattice) and counterLine(base)? These 2 functions seem to give difference contour from the same data set. contourplot(lattice) seem to give better looking contour than contourLine() or contour().

ps. I krige 1700+ simulated observations into 4000+ regular spaced data to get contour.

Thanks in advance,

simon

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Feb 11 03:12:58 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:27 EST