From tobias.verbeke at openanalytics.eu  Sun Jan 30 21:42:32 2011
From: tobias.verbeke at openanalytics.eu (Tobias Verbeke)
Date: Sun, 30 Jan 2011 21:42:32 +0100
Subject: [Rd] Clipping (was Re: patch dendrogram.R from stats [was: Re:
 dendrogram plot does not draw long labels ?])
In-Reply-To: <alpine.LFD.2.02.1101292239520.10557@gannet.stats.ox.ac.uk>
References: <AANLkTikuvd7q4xbyzEdfp+G_k1CsEM_db7zxZXpiQcWg@mail.gmail.com>
	<4D3EB147.8000906@openanalytics.eu>
	<AANLkTi=3rXNF5RQRbcQwonUqA-0Q1XBT--p4hyfNQ9VZ@mail.gmail.com>
	<4D3F323D.2090803@openanalytics.eu>
	<19780.35564.504538.916224@stat.math.ethz.ch>
	<alpine.LFD.2.02.1101292239520.10557@gannet.stats.ox.ac.uk>
Message-ID: <4D45CD38.5030409@openanalytics.eu>

On 01/29/2011 11:59 PM, Prof Brian Ripley wrote:
> On Sat, 29 Jan 2011, Martin Maechler wrote:
>
>>>>>>> Tobias Verbeke <tobias.verbeke at openanalytics.eu>
>>>>>>> on Tue, 25 Jan 2011 21:27:41 +0100 writes:
>>
>> > L.S.
>> > Please find below a patch for dendrogram.R (stats package)
>> > against revision r54107 which allows one to pass the xpd
>> > parameter as a component of the nodePar list (to be
>> > passed to plot.dendrogram).
>>
>> > I hope I did not overlook anything.
>>
>> Thank you, Tobias.
>>
>> Note BTW, that on Linux I don't have your problems that the
>> label is "not drawn" when it does not fit.
>> For me, it just is clipped (to the figure region as you note),
>> so "chopped off" but the part inside the figure box is well
>> visible.
>>
>> I was searching a bit and did not find mentioned on ?par or
>> ?clip that clipping happens device dependently,
>> but I vaguely recall to have seen it stated..
>
> Yes, it is device-dependent (but then most low-level things about
> graphics are, in particular everything about fonts).
>
> The designers of the graphics internals never documented their
> principles, but I retrospectively tried to do so in the R-ints manual.
> So whereas clipping of lines is done in the graphics engine, for text
> the manual says:
>
> If possible, the graphics device should handle clipping of text. It
> indicates this by the structure element 'canClip' which if true will
> result in calls to the callback 'clip' to set the clipping region. If
> this is not done, the engine will clip very crudely (by omitting any
> text that does not appear to be wholly inside the clipping region).
>
> I'll add a note to ?clip, but perhaps this can serve as a reminder that
> the R-ints manual is the place to look for low-level graphics details.

Many thanks, Prof Ripley and Martin, for your work
integrating the patch, documentation updates as well
as for the additional explanation putting the observed
behaviour in perspective.

Kind regards,
Tobias Verbeke



[Rd] Clipping (was Re: patch dendrogram.R from stats [was: Re: dendrogram plot does not draw long labels ?])
Tobias Verbeke