# [R] Query on contour plots

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Tue Jun 2 00:50:19 CEST 2020

Good morning Bruce & Abby,
The fruit bats of Sydney have retreated to their camps so I can
set on a 100 x 100 grid. This is how I did it:

dim(bfs)
names(bfs)
library(plotrix)
# set the matrix limits a bit beyond the data ranges
fcsc_mat<-makeDensityMatrix(bfs\$Fc,bfs\$Sc,nx=100,ny=100,
zfun="sum",xlim=c(24,29),ylim=c(-20,10))
png("bat_call.png")
par(mar=c(6,4,4,2))
color2D.matplot(fcsc_mat,
main="Freqency by chirp slope of bat calls",
extremes=c("yellow","red"),xlab="Frequency (kHz)",
ylab="Characteristic slope (octaves/s)",
border=NA,axes=FALSE)
axis(1,at=seq(5,95,10),round(seq(24.5,28.5,length.out=10),1))
axis(2,at=seq(5,95,10),round(seq(-20,10,length.out=10),1))
color.legend(0,-14,25,-10,legend=seq(0,10,length.out=5),
rect.col=color.scale(0:4,extremes=c("yellow","red")),align="rb")
text(12.5,-20,"Density (cell count)",xpd=TRUE)
dev.off()

Abby's bivariate package looks like it will do some things that
color2D.matplot won't. However, I haven't had time to install it and
try it out, so I don't know whether it will be as easy to plug
different calls onto the same grid. Also, there appears to be
constraints on the frequency and slope in the calls and I don't know
enough about them to say why. Further tweaking may lead to better
solutions.

Jim

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bat_call.png
Type: image/png
Size: 18612 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200602/af0030c1/attachment.png>