Skip to content

Identify function with matplot

2 messages · Hari Iyer, Uwe Ligges

#
Hari Iyer wrote:

            
Not directly, but you can write a wrapper for the particular case as in:

sines <- outer(1:20, 1:4, function(x, y) sin(x / 20 * pi * y))
matplot(sines, pch = 1:4, type = "o", col = rainbow(ncol(sines)))

identifyMat <- function(x, ...){
   label <- paste(row(x), ", ", col(x), sep="")
   identify(row(x), x, labels=label, ...)
}
identifyMat(sines)

Uwe Ligges