[AniMov] Defining xlim & ylim in NNCH graphs

Clément Calenge clement.calenge at oncfs.gouv.fr
Fri Dec 18 10:32:46 CET 2009


Dear Deepak,

Sorry for the late reply,

> I've been trying to define limits of the X and Y axis of NNCH 
> isopleths. I get an error message 
> > plot(homerange,xlim=c(0,600),ylim=c(0,700))
> Error in plot.default(x[[1L]], x[[2L]], xlab = xlab, ylab = ylab, ...) : 
>   formal argument "xlim" matched by multiple actual arguments
>
> I could do it for MCP
> Is there any command to define it?.

Actually, the arguments xlim and ylim are defined internally in the 
function plot.NNCH, and so cannot be used as arguments in this function. 
One possibility is to first prepare the plot and then to plot the home 
range, setting add=TRUE. For example:


## prepare the data
library(adehabitat)
data(chamois)
xy <- chamois$locs

## estimate the home range
nn <- NNCH(xy, k=6)

## The x and y limits
xli = c(min(xy[,1])-10000, max(xy[,1])+10000)
yli = c(min(xy[,2])-10000, max(xy[,2])+10000)

## First prepare the plot. Do not forget
## asp=1, which ensures that one unit
## in x has the same length as
## one unit in y
plot(c(0,1), xlim = xli, ylim=yli, asp=1, ty="n")

## then draw the plot, with add=TRUE
plot(nn, add=TRUE)


Regards,

Clément Calenge

-- 
Clément CALENGE
Cellule d'appui à l'analyse de données
Office national de la chasse et de la faune sauvage
Saint Benoist - 78610 Auffargis
tel. (33) 01.30.46.54.14



More information about the AniMov mailing list