[R] Multiple cex sizes in main for xyplot?

Bert Gunter gunter.berton at gene.com
Thu Apr 29 17:37:19 CEST 2010


Felix:

Oh, yes. That gives me what I want without having to resort to padding
parameters.

I don't know why it works (vs specifying the y locations), but I suppose
that's confounded with the details of lattice engineering, which I wanted to
avoid.

So many thanks for your help.

Bert Gunter
Genentech Nonclinical Biostatistics
 
 
-----Original Message-----
From: foolish.android at gmail.com [mailto:foolish.android at gmail.com] On Behalf
Of Felix Andrews
Sent: Wednesday, April 28, 2010 4:33 PM
To: Bert Gunter
Cc: r-help at r-project.org
Subject: Re: [R] Multiple cex sizes in main for xyplot?

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