Lattice experts:

Can you think of a way to produce a levelplot as below and then add a histogram 
of the z variable to the top margin of the plot that would sit on top of the 
color key?



x <- seq(pi/4, 5 * pi, length.out = 100)
y <- seq(pi/4, 5 * pi, length.out = 100)
r <- as.vector(sqrt(outer(x^2, y^2, "+")))
grid <- expand.grid(x=x, y=y)
grid$z <- cos(r^2) * exp(-r/(pi^3))
my.levs <- seq(-1,1,by=0.1)
my.cols <- grey(0:length(my.levs)/length(my.levs))
levelplot(z~x*y, grid, at=my.levs, scales=list(log="e"), xlab="",
          ylab="",colorkey = list(space = 'top'),col.regions = my.cols)
# is there a way to add a marginal histogram above the colorkey?
histogram(~z, grid, breaks=my.levs,col=my.cols,xlab='',ylab='',
    scales = list(draw = FALSE),
    par.settings = list(axis.line = list(col = "transparent")))

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to