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

Collapse All | Expand All

(-)dendrogram.R (-3 / +34 lines)
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
362
354
    ## handle node specific parameters in "nodePar":
363
    ## handle node specific parameters in "nodePar":
355
    hasP <- !is.null(nPar <- attr(subtree, "nodePar"))
364
    hasP <- !is.null(nPar <- attr(subtree, "nodePar"))
Lines 489-496 Link Here
489
                         font = t.font)
498
                         font = t.font)
490
                }
499
                }
491
	    }
500
	    }
492
	    plotNode(bx$limit[k], bx$limit[k + 1], subtree = child,
501
	}
493
		     type, center, leaflab, dLeaf, nodePar, edgePar, horiz)
502
    }
503
    
504
    if (inner && length(subtree)) {
505
        KK[depth] <- length(subtree)
506
        if (storage.mode(kk) != storage.mode(KK))
507
            storage.mode(kk) <- storage.mode(KK)
508
509
        ## go to first child
510
        kk[depth] <- 1L
511
        x1 <- bx$limit[1L]; x2 <- bx$limit[2L]
512
        subtree <- subtree[[1L]]
513
    }
514
    else {
515
	repeat {
516
            depth <- depth - 1
517
            if (!depth || kk[depth] < KK[depth]) break
518
	}
519
	if (!depth) break
520
	length(kk) <- depth
521
	kk[depth] <- kk[depth] + 1L
522
	k <- kk[depth]
523
	x1 <- llimit[[depth]][k]; x2 <- llimit[[depth]][k + 1L]
524
	subtree <- wholetree[[kk]]
494
	}
525
	}
495
    }
526
    }
496
    invisible()
527
    invisible()

Return to bug 15215