The R Project SVN R

Rev

Rev 59039 | Rev 67599 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 59039 Rev 61160
Line 51... Line 51...
51
  colLab <<- function(n) {
51
  colLab <<- function(n) {
52
      if(is.leaf(n)) {
52
      if(is.leaf(n)) {
53
        a <- attributes(n)
53
        a <- attributes(n)
54
        i <<- i+1
54
        i <<- i+1
55
        attr(n, "nodePar") <-
55
        attr(n, "nodePar") <-
56
            c(a$nodePar, list(lab.col = mycols[i], lab.font= i\%\%3))
56
            c(a$nodePar, list(lab.col = mycols[i], lab.font = i\%\%3))
57
      }
57
      }
58
      n
58
      n
59
  }
59
  }
60
  mycols <- grDevices::rainbow(attr(dhc21,"members"))
60
  mycols <- grDevices::rainbow(attr(dhc21,"members"))
61
  i <- 0
61
  i <- 0
62
 })
62
 })
63
dL <- dendrapply(dhc21, colLab)
63
dL <- dendrapply(dhc21, colLab)
64
op <- par(mfrow=2:1)
64
op <- par(mfrow = 2:1)
65
 plot(dhc21)
65
 plot(dhc21)
66
 plot(dL) ## --> colored labels!
66
 plot(dL) ## --> colored labels!
67
par(op)
67
par(op)
68
}
68
}
69
\keyword{iteration}
69
\keyword{iteration}