[R] lattice: How to vertically adjust an axis label?
Marius Hofert
m_hofert at web.de
Sat Jul 9 15:07:10 CEST 2011
Dear David,
thanks for the hint, I completely forgot about phantom(). With that, I can solve the problem:
library(lattice)
xyplot(0~0, xlim=c(0,3), scales=list(x=list(at=c(1,1.1),
labels=c(expression(hat(theta)[italic(n)]),
expression(phantom(hat(theta)[italic(n)])*theta*phantom(hat(theta)[italic(n)]))))))
I use phantom() to put the expression with the largest height to the left of the smaller label. Then I also put it on the right side of the smaller label in order to center the label again. It's certainly dirty, but it solves the problem :-)
Cheers,
Marius
On 2011-07-09, at 24:12 , David Winsemius wrote:
>
> On Jul 8, 2011, at 6:54 PM, Marius Hofert wrote:
>
>> Dear expeRts,
>>
>> How can I vertically adjust an axis tick label so that it is nicely aligned with
>> the other labels?
>>
>> library(lattice)
>> xyplot(0~0, xlim=c(0,3), scales=list(x=list(at=c(1,1.1), labels=c(expression(hat(theta)[italic(n)]),expression(theta)))))
>> ## aim: move the leftmost expression up so that theta is nicely aligned with the second
>
> I don't know how to make a phantom <hat>, so see if this is any more aesthetically acceptable:
>
> xyplot(0~0, xlim=c(0,3), scales=list(x=list(at=c(1,1.1), labels=c(
> expression(atop(phantom(), hat(theta)[italic(n)])),
> expression(atop(phantom(),theta)) )
> )))
>
>> theta.
>>
>> Cheers,
>>
>> Marius
>> ______________________________________________
>> 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.
>
> David Winsemius, MD
> West Hartford, CT
>
More information about the R-help
mailing list