Greek character for axis label in R zoo plot

I am trying to build a series of zoos with a Greek symbol as an 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?

+4
source share
2 answers

It seems to me that this is a mistake, because, as I said in the comments, even

plot(zoo(101:110,1:10),xlab=bquote(mu~'='~.(mu_val)))

works. I think you should report this to the zoopackage maintainer

The only way to make it work: title

plot(zoo(101:110,1:10),ylab="")
title(ylab = bquote(mu~'='~.(mu_val)))

enter image description here

+2
source

you can try

plot(zoo(101:110,1:10),ylab=expression(paste(mu,"=1")))

if you execute traceback (), you can see that the problem is in the function titlefrom the 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

enter image description here

0
source

Source: https://habr.com/ru/post/1545292/


All Articles