[AniMov] burst function in liker and kernelbb

Clément Calenge clement.calenge at oncfs.gouv.fr
Thu Jan 22 11:32:08 CET 2009

Hello Andrea,

Andrea Maxie wrote:
> I am trying to use the burst function to create Brownian bridge home ranges
> based on time of day (day and night).  I have posted a sample of the R
> command script and output below to help illustrate my issue.  I have
> numbered each day (or night – I have separated days and nights into separate
> files for each animal) with a unique, consecutive value.   
> When running the script, I get the error “Error in plot.new() : figure
> margins too large” after the Liker function, presumably because a plot is
> created for each Sig1 function.  By setting ‘plotit’ to FALSE in the Liker
> function I could move past that point, but it continues to be a problem when
> plotting the kernelbb, which in turn causes problems with outputting (see
> sample output below sample script).  
> I tried using a small number of bursts (3) with success, but still have
> problems when using many bursts.  When using three bursts, only one plot is
> created, so I am unsure why increasing the number of bursts should create a
> figure margin problem.

The following example may give you an illustration of why this problem 
occurs (just copy and paste in R):

## For example consider this graph

## Now "repeat" this graph 16 times:
for (i in 1:16)

## As you can see, the margins occupy a larger proportion of the figure
## and the information is less clear
## increase again the number of graphs
for (i in 1:25)

## You cannot see anything on these graphs!
## Increase it again:
for (i in 1:100)

### end of code

R indicates:
Error in plot.new() : figure margins too large

With such a large number of figures, R is unable to display correctly 
the information. Explaining the error. The only solution is to perform 
the analyses for subset of bursts... Now, concerning your script it is 
difficult to identify the errors without data allowing to reproduce the 
analyses. Looking at your results:

>> bb<-kernelbb(trj, sig1=1.8619, sig2, byburst=T,grid=asc)
>> save(bb, file="test3b.rdata")
>> image(bb[[1]]$UD)
> Error in plot.new() : figure margins too large

I explained above why this error occurs. However:

>> udvol<-getvolumeUD(bb)
> Error: NA/NaN/Inf in foreign function call (arg 1)

This error is strange, but it is unlikely that the "margin" error caused 
this problem. In my opinion, your data have another problem, difficult 
to identify since you did not provide any data allowing to reproduce 
your example... Maybe a burst characterized by an immobile animal led to 
a UD=0 everywhere? (i.e. all coordinates are identical)? Maybe a burst 
built up only by missing data? hard to say... but you should look at 
your data closely. Try

plot(trj, perani=FALSE)

Because you have a lot of bursts, you will probably have to do (to avoid 
the "margin error"):

plot(trj[1:12], perani=FALSE)
plot(trj[13:24], perani=FALSE)
plot(trj[25:36], perani=FALSE)

and have a look to each burst to identify the problem.

>> export.asc(udvol[[1]]$UD, "test3b.asc")
> Error in inherits(x, "asc") : object "udvol" not found

Yes, this is expected: the command getvolumeUD failed, so udvol does not 

>> ver99<-getverticeshr(bb, lev=99)
> Error: NA/NaN/Inf in foreign function call (arg 1)

Again, difficult to know why it fails (probably for the same reason as 
getvolumeUD above).

>> sh99<-kver2shapefile(ver99, which=names(ver99))
>> Error in inherits(kv, "kver") : object "ver99" not found

This is expected: the command getverticeshr failed, so ver99 does not exist.

>> write.shapefile(sh99,"test3b_ctr99")
> Error in is.vector(object) : object "sh99" not found

This is expected: the command getverticeshr failed, so ver99 does not exist.


Office national de la chasse et de la faune sauvage
Saint Benoist - 78610 Auffargis
tel. (33)

More information about the AniMov mailing list