Reputation: 153
I am trying to plot a zoo series with a Greek symbol as the axis label.
Here is the code:
mu_val <- 1
plot(1:10,101:110,main=bquote(mu~'='~.(mu_val))) ## works fine
plot(1:10,101:110,ylab=bquote(mu~'='~.(mu_val))) ## works fine
plot(zoo(101:110,1:10),main=bquote(mu~'='~.(mu_val))) ## works fine
plot(zoo(101:110,1:10),ylab=bquote(mu~'='~.(mu_val))) ## gives error
## Error in title(...) : invalid mathematical annotation
Any ideas why?
Upvotes: 4
Views: 212
Reputation: 92292
It seems like a bug to me, because as I said in comments, even
plot(zoo(101:110,1:10),xlab=bquote(mu~'='~.(mu_val)))
works. I think you should report it to the zoo
package maintainers
The only way I could make it work is using title
plot(zoo(101:110,1:10),ylab="")
title(ylab = bquote(mu~'='~.(mu_val)))
Upvotes: 2
Reputation: 3597
you could try
plot(zoo(101:110,1:10),ylab=expression(paste(mu,"=1")))
if you do traceback(), you can see that it the issue is in title
function from help ?title
They must be of type character or expression. In the latter case, quite a bit of mathematical
notation is available such as sub- and superscripts, greek letters, fractions, etc: see plotmath
Upvotes: 0