[Rd] Bug in stats::plot.hclust/graphics:::plotHclust/underlying C code (C_dend) in R-3.0?

Peter Langfelder peter.langfelder at gmail.com
Sat Jun 1 01:32:06 CEST 2013


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

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)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

-------------------------- Session info for R-3.0.0

R version 3.0.0 (2013-04-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

and under Linux

R version 3.0.0 Patched (2013-04-24 r62658)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C                 LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

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.

Thanks,

Peter



More information about the R-devel mailing list