[R] Updating in attempt to rotate ylab
Deepayan Sarkar
deepayan.sarkar at gmail.com
Sat Nov 12 16:15:46 CET 2005
On 11/12/05, Michael Kubovy <kubovy at virginia.edu> wrote:
> What am I doing wrong? (please cc me when replying)
>
> yy <- 1:10
> xx <- yy*2
> xYplot(yy~xx,ylab="") #this plots as it should
>
> text(.4,5,expression(paste(log, frac(p(b),p(a)) )))
>
> Error in text.default(0.4, 13, expression(paste(log, frac(p(b), p
> (a))))) :
> plot.new has not been called yet
You are trying to mix grid and base graphics, which is not allowed (at
least not without some further work). In any case, this approach won't
get you anywhere.
> This is the case even when I write:
>
> xxyy <- xYplot(yy~xx,ylab="")
> xxyy <- update(xxyy, text(.4,5,expression(paste(log, frac(p(b),p
> (a)) ))) )
>
> More generally: is there a simple method for rotating ylab?
No, but you can specify an arbitrary (unrotated text in this case) ylab as
ylab = grid::textGrob(expression(paste(log, frac(p(b),p(a)))) )
[ This works in xyplot etc, and should in xYplot as well, but I
haven't checked ]
Deepayan
More information about the R-help
mailing list