[Rd] plot.dendrogram xlim/ylim

Felix Andrews felix at nfrac.org
Thu Jul 24 05:16:22 CEST 2008


list(...),

I would like to zoom in to the leaves of large trees in a dendrogram
plot. The playwith package allows zooming by passing xlim and ylim
arguments to the plot call (Hmisc does this too I think). But
currently stats:::plot.dendrogram does not accept xlim or ylim. So I
would like to enable that. In place of the existing code chunk:

    xlim <- c(x1 - 1/2, x2 + 1/2)
    ylim <- c(0, yTop)
    if (horiz) {
        xl <- xlim
        xlim <- rev(ylim)
        ylim <- xl
        tmp <- xaxt
        xaxt <- yaxt
        yaxt <- tmp
    }
    plot(0, xlim = xlim, ylim = ylim, ......

I propose something like:

function(..., xlim, ylim)

    xlim0 <- c(x1 - 1/2, x2 + 1/2)
    ylim0 <- c(0, yTop)
    if (horiz) {
        xl <- xlim0
        xlim0 <- rev(ylim0)
        ylim <- xl
        tmp <- xaxt
        xaxt <- yaxt
        yaxt <- tmp
    }
    if (missing(xlim)) xlim <- xlim0
    if (missing(ylim)) ylim <- ylim0
    plot(0, xlim = xlim, ylim = ylim, ......


Regards,
Felix

-- 
Felix Andrews / 安福立
PhD candidate
Integrated Catchment Assessment and Management Centre
The Fenner School of Environment and Society
The Australian National University (Building 48A), ACT 0200
Beijing Bag, Locked Bag 40, Kingston ACT 2604
http://www.neurofractal.org/felix/
3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8



More information about the R-devel mailing list