[R] [lattice] levelplot for 2D density plots

Sebastian Weber sebastian.weber at physik.tu-darmstadt.de
Thu Feb 1 17:01:19 CET 2007


Hello all,

I'm trying to use the levelplot lattice function and can not adapt it to
my tastes concering colors:

dens <- data.frame(x=c(), y=c(), z=c(), run=c())
for(l in levels(degCorrel$run)) {
  ind <- degCorrel$run == l
  dk <- kde2d(log10(degCorrel$correlFunc[ind]), log10(degCorrel
$correlFunc.ref[ind]), n=50)
  dt <- cbind(con2tr(dk), run=l)
  dt$z <- dt$z/sum(dt$z)
  dens <- rbind(dens, dt)
}
dens$run <- factor(dens$run)

levelplot(z ~ x *y | run, data=dens)

However, I need to adjust the cuts for every panel differently since the
scales are very different. I know, that this is not a very good
practice, but anyway, how can I do it?

Any help is greatly appreciated. Thanks in advance,

Sebastian



More information about the R-help mailing list