[R] lattice: how to "center" a subtitle?

Marius Hofert m_hofert at web.de
Mon Apr 4 18:45:31 CEST 2011


Dear David,

I intended to use another x-label. But your suggestion brings me to the idea of just using a two-line xlab, so s.th. like
print(xyplot(0 ~ 0, xlab.top = "This title is now 'centered' for the human's eye", xlab = "but subtitles are _now_ centered\nbla", scales = list(alternating = c(1,1), tck = c(1,0))))

Thanks!

Cheers,

Marius

On 2011-04-04, at 16:47 , David Winsemius wrote:

> 
> On Apr 4, 2011, at 7:39 AM, Marius Hofert wrote:
> 
>> Dear expeRts,
>> 
>> I recently asked for a real "centered" title (see, e.g., http://tolstoy.newcastle.edu.au/R/e13/help/11/01/0135.html).
>> A nice solution (from Deepayan Sarkar) is to use "xlab.top" instead of "main":
>> 
>> library(lattice)
>> trellis.device("pdf")
>> print(xyplot(0 ~ 0, xlab.top = "This title is now 'centered' for the human's eye", sub = "but subtitles are not centered", scales = list(alternating = c(1,1), tck = c(1,0))))
>> dev.off()
> 
> library(lattice)
> trellis.device("pdf")
> print(xyplot(0 ~ 0, xlab.top = "This title is now 'centered' for the human's eye", xlab = "but subtitles are _now_ centered", scales = list(alternating = c(1,1), tck = c(1,0))))
> dev.off()
> 
> 
> (I realize that those are not really subtitles by a 'lab', but that appears acceptable in your current test case.)
> 
>> 
>> My question is whether there is something similar for *sub*titles [so something like "xlab.bottom"]? As you can see from the plot, the subtitle does not seem to be "centered" for the human's eye. I would like to center it according to the x-axis label.
>> 
> 
> 
> David Winsemius, MD
> West Hartford, CT
> 



More information about the R-help mailing list