Skip to content
Prev 306391 / 398506 Next

Comparing density plots using same axes or same axes scale

Hello,

Something like this?

sag <- matrix(rnorm(1e3 * 9), ncol = 9)

d.list <- apply(sag, 2, density)
xrange <- range(sapply(d.list, function(d) range(d$x)))
ymax <- max(sapply(d.list, function(d) max(d$y)))

op <- par(mfrow=c(3,3))
for(i in 1:9)
     plot(d.list[[i]], xlim = xrange, ylim = c(0, ymax))
par(op)


Hope this helps,

Rui Barradas
Em 27-09-2012 01:53, Meredith Ballard LaBeau escreveu: