Italic greek letters / latex-style math in plot titles

I'd like to create latex-style math in plot titles in R. The [plotmath tools](http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/plotmath.html) have a useful but limited subset of expressions they can display, and use non-latex syntax and style. For instance, I would like to print the equation $\mathrm{d} \mathbf{x} = a [\theta - \mathbf{x}] \mathrm{d} t$ in the title of the plot, and still evaluate the value of certain variables. The best solution I have is the very cumbersome: lambda <- 4 plot(1:10,1:10) mtext(bquote(paste(d*bolditalic(x)[italic(t)] == alpha*(theta - bolditalic(x)[italic(t)] )*d*italic(t) + .(lambda) * d * italic(B)[italic(t)] )), line=2.25,cex=2) or require(ggplot2) qplot(1:10, 1:10) + opts(title=bquote(paste(d*bolditalic(x)[italic(t)] == alpha*(theta - bolditalic(x)[italic(t)] )*d*italic(t) + .(lambda) * d * italic(B)[italic(t)] )), line=2.25,cex=2) [This question](https://stackoverflow.com/questions/6047187/bolding-greek-letters-in-r) almost solves this, but I loose the ability of bquote to display the numerical value of a variable (lambda in my example). Is there a way to combine these so I can have italic greek letters (the standard format for variables, e.g. as done by tex) and evaluate at specific values? Is there a much better way where I can simple write tex-syntax for equations and add them to my graphs?
I'd also like to display square as in my latex style equation, instead of parentheses, but cannot see how to do this either.

以上就是Italic greek letters / latex-style math in plot titles的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏