I'm putting this back on the list. > So how would I set up the code to do this with the data type I have?
> I will need to replicate the same task > 200 times with other data sets. > What I need to do is plot *Fc *against *Sc* with the third dimension being > the *density* of the data points. Using Jim's bat_call data: library (bivariate) plot_ds <- function (dataset, main="", xlim, ylim, ..., k1=1, k2=1) { names <- names (dataset) fh <- kbvpdf (dataset [,1], dataset [,2], k1 * bw.nrd (dataset [,1]), k2 * bw.nrd (dataset [,2]) ) plot (fh, main=main, xlab = names [1], ylab = names [2], xlim=xlim, ylim=ylim, ncontours=2) } plot_ds (bat_call, "plot 1", k1=1.25, k2=1.25) Note that I've used stats::bw.nrd. The k1 and k2 values, simply scale the default bandwidth. (In this case, I've increased the smoothness). If you want to do it 200+ times: (1) Create another function, to iterate over each data set. (2) If you want to save the plots, you will need to add in a call to pdf/png/etc and close the device, in each iteration. (3) It may be desirable to have constant xlim/ylim values, ideally based on the ranges of the combined data: plot_ds (bat_call, "plot 1", xlim = c (25, 30), ylim = c (-15, 10), k1=1.25, k2=1.25) ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.