Similar to this question, I'd like to to add marginal histograms or boxplots to a xyplot
or densityplot
using lattice
. Is there a way to replace the right and/or top axes with these plots instead?
Something like:
library(lattice)
x <- rnorm(100)
y <- rnorm(100)
xyplot(x~y,
x.top = histogram(~x), # desired
y.right = bwplot(~y) # desired
)
How could I do this?