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

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Jan 29 23:59:10 CET 2011

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 

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list