[R] Multiple cex sizes in main for xyplot?

Felix Andrews felix at nfrac.org
Thu Apr 29 01:33:10 CEST 2010


I don't think there's a much better way to do it... but this seems to work:

xyplot((0:1)~(0:1),
       main = textGrob(lab=c("Some Text","\nSome More Text"),x=c(0.5,0.5),
                       gp=gpar(cex=c(1.2,1.0), lineheight=2))
       )

-Felix


On 29 April 2010 08:06, Bert Gunter <gunter.berton at gene.com> wrote:
> Folks:
>
> I would like to write two lines of text in two different font sizes (or
> faces or ...) as the title ("main") of a trellis plot.  The following code
> does it, but not well:
>
> xyplot((0:1)~(0:1),
>        main = textGrob(lab=c("Some Text","Some More Text"),y=c(.95,.8),
>                        gp=gpar(cex=c(1.2,1.0)))
>        )
>
> There is too much space between the title text and the plot. I assume that
> can be fixed by fooling with padding settings in lattice.options(), but my
> question is: Is there a better, simpler way to do this?
> Would using grid graphics directly by pushing title and plot viewports and
> then adding the lattice graph to the plot viewport be a better way to go?
>
> OS = Windows XP
> R = 2.11.0
> lattice_0.18-3
> device = windows
>
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Felix Andrews / 安福立
Postdoctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 4670
E: felix.andrews at anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/



More information about the R-help mailing list