[Rd] plot.dendrogram xlim/ylim

Martin Maechler maechler at stat.math.ethz.ch
Thu Jul 24 09:49:39 CEST 2008


>>>>> "FA" == Felix Andrews <felix at nfrac.org>
>>>>>     on Thu, 24 Jul 2008 13:16:22 +1000 writes:

    FA> list(...), I would like to zoom in to the leaves of
    FA> large trees in a dendrogram plot. The playwith package
    FA> allows zooming by passing xlim and ylim arguments to the
    FA> plot call (Hmisc does this too I think). But currently
    FA> stats:::plot.dendrogram does not accept xlim or ylim. So
    FA> I would like to enable that. In place of the existing
    FA> 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, ......

Thank you for the suggestion!
Yes, "something like" this will be part of R 2.8.0
(or 'R-devel' as from tomorrow).

Martin Maechler, ETH Zurich

>>  -- 
>>  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