Topic: CTFS Plot Maps

Topic Description:

Functions for maps of CTFS plot data. The file map.r has functions for tree distribution maps, including overlays of elevation contours. The file mapresponse.r has functions for creating color or contour maps of any numerical responses, based on the R functions image, contour, and filled.contour.



File: map/map.r

View File Source Download File No help file available

Function: map1species

Function Description: map1species

This does the mapping for a single species, called from map() but also useful on its own. With add=TRUE, points are added to an existing map. All other parameters are described with map().

Function Arguments:

ArgumentDefault Value
sppdata
plotdimc(1000,500)
xrangec(0,plotdim[1])
yrangec(0,plotdim[2])
color"black"
bgcolor"white"
axspos.5
xaxisTRUE
yaxisTRUE
symbol16
sizerep(-1
3)
cutoffc(10,100,300,3000)
axisdiv100
labsize1.75
plotside4
addFALSE

Function Source:


map1species=function(sppdata,plotdim=c(1000,500),xrange=c(0,plotdim[1]),yrange=c(0,plotdim[2]),color
        ="black",bgcolor="white",axspos=.5,
xaxis=TRUE,yaxis=TRUE,symbol=16,size=rep(-1,3),cutoff=c(10,100,300,3000),axisdi
        v=100,labsize=1.75,plotside=4,add=FALSE) {
xdim=diff(xrange)
ydim=diff(yrange)
aspect=xdim/ydim

nogrp=length(cutoff)-1
grp=matrix(FALSE,nrow=nogrp,ncol=dim(sppdata)[1])

if(size[1]<0) size=setsize(nogrp,length(sppdata$gx))

for(i in 1:nogrp) grp[i,]=(sppdata$dbh>=cutoff[i] & sppdata$dbh # browser()

if(add)
{
# browser()
points(sppdata$gx[grp[1,]],sppdata$gy[grp[1,]],cex=size[1],col=color,pch=symbol)
if(nogrp>1)

for(i in 2:nogrp) points(sppdata$gx[grp[i,]],sppdata$gy[grp[i,]],cex=size[i],col=color,pch=sym
        bol) return(0)
}

graphsize=c(plotside,plotside/aspect)

oldpar=par(pch=symbol,col=color,col.main="black",bg=bgcolor,pin=graphsize,col.axis="black",mgp=c(3
        ,axspos,0))

plot(sppdata$gx[grp[1,]],sppdata$gy[grp[1,]],xlim=xrange,ylim=yrange,axes=F,xlab="",ylab="",cex=si
        ze[1],col=color)
if(nogrp>1) for(i in 2:nogrp) points(sppdata$gx[grp[i,]],sppdata$gy[grp[i,]],cex=size[i],col=color
        ) # browser()

atx=c(seq(xrange[1],xrange[2]-.5,by=axisdiv),xrange[2])
aty=c(seq(yrange[1],yrange[2]-.5,by=axisdiv),yrange[2])
if(xaxis) axis(side=1,pos=yrange[1],at=atx,cex.axis=labsize)
if(yaxis) axis(side=2,pos=xrange[1],at=aty,cex.axis=labsize)
if(xaxis) axis(side=3,at=atx,labels=FALSE,pos=yrange[2])
if(yaxis) axis(side=4,at=aty,labels=FALSE,pos=xrange[2])

# par(oldpar)
# browser()
}