[R] lattice dotplot: line height for multi-line labels

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Aug 7 19:24:52 CEST 2009


On 8/7/09, Boris.Vasiliev at forces.gc.ca <Boris.Vasiliev at forces.gc.ca> wrote:
> Dear R-users,
>
>  I am looking for suggestions on how to control the line-height for
>  multi-line labels in lattice dotplot.
>
>  In particular, in the dotplot produced by
>
>  library(lattice)
>  aa <- c('A'=10,'B\nb'=20,'C'=30)
>  dotplot(aa)
>
>  I would like to control the vertical separation between 'B' and 'b' in
>  the second label on the y-axis.
>
>  For multi-line axes labels, line height is controlled by the
>  'lineheight' elements of the 'par.ylab.text' and 'par.xlab.tex' lists
>  provided by trellis.par.get().  However, 'lineheight' is not available
>  in 'axis.text'  list retuned by trellis.par.get().
>
>  Does lattice provided a 'lineheight' parameter to control line-heights
>  in axis labels?

No, but setting it globally as a grid parameter seems to work:

dotplot(aa, par.settings = list(grid.pars = list(lineheight = 2)))

-Deepayan




More information about the R-help mailing list