I'd like to create latex-style math in plot titles in R. The plotmath tools 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 [heta - 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 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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…