【问题标题】:greek symbol for axis label in R zoo plotR动物园图中轴标签的希腊符号
【发布时间】:2014-06-19 21:34:06
【问题描述】:

我正在尝试绘制一个以希腊符号作为轴标签的动物园系列。

代码如下:

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

有什么想法吗?

【问题讨论】:

  • 对我来说似乎是一个错误,因为即使 plot(zoo(101:110,1:10),xlab=bquote(mu~'='~.(mu_val))) 也可以
  • 你应该联系包维护者。

标签: r zoo


【解决方案1】:

这对我来说似乎是一个错误,因为正如我在 cmets 中所说的那样,甚至

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

有效。我认为你应该向zoo 包维护者报告它

我可以让它工作的唯一方法是使用title

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

【讨论】:

    【解决方案2】:

    你可以试试

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

    如果您执行 traceback(),您可以从帮助 ?title 中看到问题出在 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
    

    【讨论】:

    • 问题是我希望 "=1" 成为在运行时设置的变量。
    猜你喜欢
    • 2012-05-23
    • 2021-02-16
    • 1970-01-01
    • 2014-11-10
    • 2012-10-15
    • 2015-02-25
    • 1970-01-01
    • 1970-01-01
    • 2019-02-06
    相关资源
    最近更新 更多