[R] How to change the font size on the title of a xyplot

Duncan Mackay dulcalma at bigpond.com
Sun May 11 06:11:50 CEST 2014


Hi

Just an addition for the future :
If you wanted to have different main title plots to the same device then
par.settings can be used for each plot

xyplot(1 ~1, 
             par.settings = list(par.main.text = 0.85,
                                               par.sub.text = 0.85)
                                            strip.background = list(col =
"transparent")), # blank strip background
             ...)

see
names(trellis.par.get())

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Eduardo M. A. M. Mendes
Sent: Sunday, 11 May 2014 11:16
To: David Winsemius
Cc: r-help at r-project.org
Subject: Re: [R] How to change the font size on the title of a xyplot

cex=0.85 did the job for me.

many thanks

Ed

On May 10, 2014, at 10:13 PM, David Winsemius <dwinsemius at comcast.net>
wrote:

> 
> On May 10, 2014, at 6:06 PM, Eduardo M. A. M. Mendes wrote:
> 
>> library(zoo);
>> library(lattice);
>> 
>> a=matrix(runif(100),25,4);
>> b=zoo(a,seq(1,25));
>> names(b)=c("How to change the font size?","2","3","4");
>> xyplot(b)
>> 
> 
> xyplot(b, strip=strip.custom( par.strip.text=list(cex=.5)))
> 
> -- 
> David.
>> Ed
>> 
>> On May 10, 2014, at 9:52 PM, David Winsemius <dwinsemius at comcast.net>
wrote:
>> 
>>> 
>>> On May 10, 2014, at 5:47 PM, Eduardo M. A. M. Mendes wrote:
>>> 
>>>> Yes, you are right.  I meant panels,   xyplot generates 22 panels,
which one with y-axis, x-axis and a title.  I need to change the font size
of title in the panels.
>>>> 
>>> 
>>> It appears to me that the answer is probably in :
>>> 
>>> ?strip.default
>>> 
>>> Still no example, so no code.
>>> 
>>> -- 
>>> David.
>>> 
>>>> Ed
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On May 10, 2014, at 8:04 PM, David Winsemius <dwinsemius at comcast.net>
wrote:
>>>> 
>>>>> 
>>>>> On May 10, 2014, at 3:30 PM, Eduardo M. A. M. Mendes wrote:
>>>>> 
>>>>>> Hello
>>>>>> 
>>>>>> Many thanks.
>>>>>> 
>>>>>> par.main.text is the main title (on top of all plots).  I need to
change the each of the titles in the, say, subplots.
>>>>>> 
>>>>> 
>>>>> One gets the response the fills ones needs when those needs are
clearly expressed and an example provide that illustrates the problem. There
being no "subplot" in lattice, I'm guessing that you mean "panel" for that
term,  and the "title" is in fact the strip annotation, but I am finished
with throwing out guesswork solutions until clarity is established.
>>>>> 
>>>>> -- 
>>>>> David.
>>>>> 
>>>>>> Ed
>>>>>> 
>>>>>> 
>>>>>> On May 10, 2014, at 7:05 PM, David Winsemius <dwinsemius at comcast.net>
wrote:
>>>>>> 
>>>>>>> 
>>>>>>> On May 10, 2014, at 2:26 PM, Eduardo M. A. M. Mendes wrote:
>>>>>>> 
>>>>>>>> Hello
>>>>>>>> 
>>>>>>>> I am using xyplot (lattice) to plot a xts variable.  There are 20
variables within the xts variable (index by a datetime vector sampled every
1 minute).  The results are very nice and help me to understand what is
going on with the data. However since the names (labels of each variable)
within the xts variable are large, the title of each plot is cropped.   How
can I select the font size of the titles without changing all other fonts?
>>>>>>>> 
>>>>>>> 
>>>>>>> tp <- trellis.par.get()
>>>>>>> names(tp)
>>>>>>> 
>>>>>>> ... includes "par.main.text", so my first try was to use the
xyplot() facilities to change cex for 'main'. Seems to work as expected:
>>>>>>> 
>>>>>>> xyplot( 1~1, main="test",
par.settings=list(par.main.text=list(cex=5)))
>>>>>>> 
>>>>>>> --
>>>>>>> 
>>>>>>> David Winsemius
>>>>>>> Alameda, CA, USA
>>>>>>> 
>>>>>> 
>>>>> 
>>>>> David Winsemius
>>>>> Alameda, CA, USA
>>>> 
>>> 
>>> David Winsemius
>>> Alameda, CA, USA
>> 
> 
> David Winsemius
> Alameda, CA, USA


	[[alternative HTML version deleted]]

______________________________________________
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.



More information about the R-help mailing list