[Rd] Bug in stats::plot.hclust/graphics:::plotHclust/underlying C code (C_dend) in R-3.0?
maechler at stat.math.ethz.ch
Sat Jun 1 18:48:18 CEST 2013
>>>>> Peter Langfelder <peter.langfelder at gmail.com>
>>>>> on Fri, 31 May 2013 16:32:06 -0700 writes:
> Hi all, it appears that plot.hclust disregards the
> argument 'cex'. Up until 2.15.1 (and probably all 2.15.x),
> specifying cex in plot.hclust changed the size of the
> plotted labels on each leaf. In 3.0.0 the character size
> remains the same irrespective of the cex setting. Since
> the help text for plot.hclust does not mention the cex
> argument, it is possible that an "undocumentde feature"
> was simply removed - but it was very useful when it was
> The following code illustrates the problem:
> data = c(1:20)
> dst = dist(data)
> tree = hclust(dst, method = "a")
> plot(tree, cex = 1)
> plot(tree, cex = 0.5)
> plot(tree, cex = 0.2)
> Under R-2.15 and earlier, the leaf labels would get
> progressively smaller; under 3.0.0, the label size remains
> the same. I tried this both under Windows
> R version 2.15.1 (2012-06-22)
> R version 3.0.0 (2013-04-03)
> and under Linux
> R version 3.0.0 Patched
> Looking at the source code of plot.hclust leads to
> graphics:::plotHclust which calls .External.graphics,
> which is where my ability to read code quickly stops :)
> I realize that these are not the most recent releases but
> I couldn't find anything mentioning a bug fix for this in
> the changelog, so I assume it has not been fixed.
You are right. Duncan Murdoch found the place (in the C code
indeed), and I've found and fixed the small inconsistency that
happened (between 2.15.x and 3.0.0) when that code was slightly
streamlined and moved to the 'graphics' package.
Thank you Peter, for reporting it in such a precise manner!
Martin Maechler, ETH Zurich
More information about the R-devel