View | Details | Raw Unified | Return to bug 15215 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-4 / +30 lines)
Line  Link Here
0
-- dendrogram.R        2015-05-01 18:36:19.155750000 +0700
0
++ dendrogram_new.R    2015-05-02 08:31:49.546500000 +0700
Lines 1-7 Link Here
1
#  File src/library/stats/R/dendrogram.R
1
#  File src/library/stats/R/dendrogram.R
2
#  Part of the R package, http://www.R-project.org
2
#  Part of the R package, http://www.R-project.org
3
#
3
#
4
#  Copyright (C) 1995-2014 The R Core Team
4
#  Copyright (C) 1995-2015 The R Core Team
5
#
5
#
6
#  This program is free software; you can redistribute it and/or modify
6
#  This program is free software; you can redistribute it and/or modify
7
#  it under the terms of the GNU General Public License as published by
7
#  it under the terms of the GNU General Public License as published by
Lines 346-355 Link Here
346
    function(x1, x2, subtree, type, center, leaflab, dLeaf,
346
    function(x1, x2, subtree, type, center, leaflab, dLeaf,
347
            nodePar, edgePar, horiz = FALSE)
347
            nodePar, edgePar, horiz = FALSE)
348
{
348
{
349
    wholetree <- subtree
350
    depth <- 0
351
    llimit <- list()
352
    KK <- integer()
353
    kk <- integer()
354
355
    repeat {
349
    inner <- !is.leaf(subtree) && x1 != x2
356
    inner <- !is.leaf(subtree) && x1 != x2
350
    yTop <- attr(subtree, "height")
357
    yTop <- attr(subtree, "height")
351
    bx <- plotNodeLimit(x1, x2, subtree, center)
358
    bx <- plotNodeLimit(x1, x2, subtree, center)
352
    xTop <- bx$x
359
    xTop <- bx$x
360
    depth <- depth + 1
361
    llimit[[depth]] <- bx$limit
353
    ## handle node specific parameters in "nodePar":
362
    ## handle node specific parameters in "nodePar":
354
    hasP <- !is.null(nPar <- attr(subtree, "nodePar"))
363
    hasP <- !is.null(nPar <- attr(subtree, "nodePar"))
Lines 401-406 Link Here
401
           text(X, Y, nodeText, xpd = lab.xpd, srt = srt, adj = adj,
410
           text(X, Y, nodeText, xpd = lab.xpd, srt = srt, adj = adj,
402
                 cex = lab.cex, col = lab.col, font = lab.font)
411
                 cex = lab.cex, col = lab.col, font = lab.font)
403
       }
412
       }
413
       repeat {
414
            depth <- depth - 1
415
            if (depth == 0 || kk[depth] < KK[depth]) break
416
       }
417
       if (depth == 0) break
418
       length(kk) <- depth
419
       k <- kk[depth] <- kk[depth] + 1L
420
       x1 <- llimit[[depth]][k]; x2 <- llimit[[depth]][k + 1L]
421
       subtree <- wholetree[[kk]]
404
    }
422
    }
405
    else if (inner) {
423
    else if (inner) {
406
       segmentsHV <- function(x0, y0, x1, y1) {
424
       segmentsHV <- function(x0, y0, x1, y1) {
Lines 489-497 Link Here
489
                         font = t.font)
507
                         font = t.font)
490
                }
508
                }
491
           }
509
           }
492
           plotNode(bx$limit[k], bx$limit[k + 1], subtree = child,
493
                    type, center, leaflab, dLeaf, nodePar, edgePar, horiz)
494
       }
510
       }
511
       if (!length(subtree)) break
512
        KK[depth] <- length(subtree)
513
        if (storage.mode(kk) != storage.mode(KK))
514
            storage.mode(kk) <- storage.mode(KK)
515
        kk[depth] <- 1L
516
        x1 <- bx$limit[[1L]]; x2 <- bx$limit[[2L]]
517
        subtree <- subtree[[1L]]
518
    }
519
    else
520
        break
495
    }
521
    }
496
    invisible()
522
    invisible()
497
}
523
}

Return to bug 15215