[Rd] plot.dendrogram and expressions

Martin Maechler maechler at stat.math.ethz.ch
Mon Mar 15 10:19:01 MET 2004

Hi Torsten (et al),

>>>>> "Torsten" == Torsten Hothorn <Torsten.Hothorn at rzmail.uni-erlangen.de>
>>>>>     on Fri, 12 Mar 2004 15:48:00 +0100 (CET) writes:

    Torsten> Hi,

    Torsten> currently the "label" and "edgetext" attributes of
    Torsten> a dendrogram are coerced to character before they
    Torsten> are added to a plot with `text'. Is there a
    Torsten> specific reason to do so (expect for the
    Torsten> determination of the size of the character string
    Torsten> to be plotted)? 

that used to be a reason AFAIR but nowadays, strwidth() and strheight()
do work correctly with expressions and also do an "internal as.character()"
as well.
Also, text() typically coerces its 'labels' argument to
character though text() is generic nowadays, and the coercion is
not really guaranteed.

For compatibilty & "safety" reasons, 
it might be better to keep do as.character() *unless* the
attributes are of mode "expression" ...

Other opionions?

    Torsten> Otherwise one could plot the attributes directly via

    Torsten> diff dendrogram.R /usr/src/R/src/library/stats/R/dendrogram.R
    Torsten> 317c317
    Torsten> <               text(xBot, yBot + vln, attr(child,"label"))
    Torsten> ---
    >> text(xBot, yBot + vln, nodeText)
    Torsten> 337c337
    Torsten> <                 text(mx, my, attr(child, "edgetext"))
    Torsten> ---
    >> text(mx, my, edgeText)
    Torsten> 344c344
    Torsten> <                 text(xBot, my, attr(child, "edgetext"))
    Torsten> ---
    >> text(xBot, my, edgeText)

    Torsten> and one could use expressions for plotting symbols.

yes, that's a good idea and will be allowed in 1.9.0

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

More information about the R-devel mailing list