[Rd] plot.hclust: dendrogram too large for window (PR#4197)
maechler at stat.math.ethz.ch
maechler at stat.math.ethz.ch
Tue Sep 30 19:04:13 MEST 2003
Thank you, Peter,
>>>>> "Peter" == Peter Kleiweg <kleiweg at let.rug.nl>
>>>>> on Wed, 17 Sep 2003 01:30:58 +0200 (MET DST) writes:
Peter> plot.hclust:
Peter> Setting up a window for a dendrogram assumes the first link is
Peter> the shortest and the last is the longest. This is not always the
Peter> case when the clustering was done with hclust, method="median"
Peter> or method="centroid", and the dendrogram sometimes doesn't fit
Peter> within the window.
Peter> I propose the fix listed below.
I'm about to apply this fix to "R 1.8.0 beta".
Can you please __quickly__ give a reproducible *example* for
which this bug applies, i.e., for which the fix will make a
difference?
Thanks in advance:
Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
Peter> src/main/
Peter> --- plot.c Wed Sep 17 01:03:39 2003
Peter> +++ plot.c.new Wed Sep 17 01:21:59 2003
Peter> @@ -3314,7 +3314,7 @@
Peter> SEXP do_dendwindow(SEXP call, SEXP op, SEXP args, SEXP env)
Peter> {
Peter> int i, imax, n;
Peter> - double pin, *ll, tmp, yval, *y, ymin, ymax, yrange;
Peter> + double pin, *ll, tmp, yval, *y, ymin, ymax, yrange, m;
Peter> SEXP originalArgs, merge, height, llabels, str;
Peter> char *vmax;
Peter> DevDesc *dd;
Peter> @@ -3357,8 +3357,14 @@
Peter> ll = (double*)R_alloc(n, sizeof(double));
Peter> dnd_lptr = &(INTEGER(merge)[0]);
Peter> dnd_rptr = &(INTEGER(merge)[n]);
Peter> - ymin = REAL(height)[0];
Peter> - ymax = REAL(height)[n - 1];
Peter> + ymax = ymin = REAL(height)[0];
Peter> + for (i = 1; i < n; i++) {
Peter> + m = REAL(height)[i];
Peter> + if (m > ymax)
Peter> + ymax = m;
Peter> + if (m < ymin)
Peter> + ymin = m;
Peter> + }
Peter> pin = Rf_gpptr(dd)->pin[1];
Peter> for (i = 0; i < n; i++) {
Peter> str = STRING_ELT(llabels, i);
Peter> --please do not edit the information below--
Peter> Version:
Peter> platform = i686-pc-linux-gnu
Peter> arch = i686
Peter> os = linux-gnu
Peter> system = i686, linux-gnu
Peter> status =
Peter> major = 1
Peter> minor = 7.1
Peter> year = 2003
Peter> month = 06
Peter> day = 16
Peter> language = R
Peter> Search Path:
Peter> .GlobalEnv, package:methods, package:ctest, package:mva, package:modreg, package:nls, package:ts, Autoloads, package:base
More information about the R-devel
mailing list