cmprobst wrote:
Dear List,

I have an array of 6400 x 56 elements. I want to calculate the density function for each column and plot all 56 density functions in one plot.

I have tried several procedures, but they all failed.

What can I do?

56 lines could even confuse a spider, so you might want to re-think your plotting approach. However....


## untested code!
## get a density object for each column.
den.list <- apply(zz,2,density)

## set up your plot window
all.x <- sapply(den.list,function(d,...) {d$x})
all.y <- sapply(den.list,function(d,...) {d$y})
plot(all.x,all.y,type="n")

## now plot each one on that graph
## this will make each line the same colour; for
## different line types or colours, you'll probably
## have to use a for() loop.

lapply(den.list,function(d,...) {lines(d$x,d$y)})

There's probably a much, much cleaner way to do that, though. I think the sm library has the sm.density function that takes an "add" argument to its plots... too busy to check that out on this box, however.

Cheers

Jason

--
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
[EMAIL PROTECTED]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to