[R] Leading in line-wrapped Lattice axis value and panel labels

Tim Churches tchur at optushome.com.au
Wed Sep 7 23:40:42 CEST 2005


Paul Murrell wrote:

> Hi
>
> Deepayan Sarkar wrote:
> > On 9/7/05, Tim Churches <tchur at optushome.com.au> wrote:
> >
> >> Version 2.1.1 Platforms: all
> >>
> >> What is the trellis parameter (or is there a trellis parameter) to
> >> set the leading (the gap between lines) when long axis values
> >> labels or panel header labels wrap over more than one line? By
> >> default, there is a huge gap between lines, and much looking and
> >> experimentation has not revealed to me a suitable parameter to
> >> adjust this.
> >>
> >
> > There is none. Whatever grid.text does happens.
>
> grid does have a "lineheight" graphical parameter.  For example,
>
> library(grid)
> grid.text("line one\nlinetwo",
>           x=rep(1:3/4, each=3),
>           y=rep(1:3/4, 3),
>           gp=gpar(lineheight=1:9/2))
>
> Could you add this in relevant places in trellis.par Deepayan?
>
Is there a work around we could use in the meantime, or should we 
attempt to hack trellis.par as per Paul's suggestion (gulp!)?  I suppose 
that is like asking "Should we attempt to climb Teichelmann?" - it 
depends... We have increased the depth of the panel headers, but this 
wastes plotting area and the tops of the tees and effs on the upper line 
and the bottoms of the gees and whys on the bottom line are still cut 
off, so large is the gap between the two lines.  And increasing the 
panel header depth it doesn't help with y-axis labels - typically the 
second line of one label will abut the first line of the next label, 
giving a results which  is rather like:

Value
               -
One
Value
              -
Two
Value
             -
Three
Value
            -
Four

where the actual value labels are "Value One", "Value Two" etc and the 
"-" are the tick marks. Less than ideal.

Suggestions for interim fixes (other than using abbreviated labels... 
we've thought of that) most welcome.

Tim C




More information about the R-help mailing list