Jason Rupert
2010-Jan-21 22:10 UTC
[R] Displaying Equation With Numerator and Demomenator On A Plot...
Is there a way to display something like the quadratic equation, i.e. with a numerator and demonator on a plot? I think there is a way to create the equation in Latex, but wasn't sure if this format would translate to plotting. \begin{equation} ? x = \frac{b +/- sqrt(b^2 - 4*a*c)}{2*a} \end{equation} ? My searched turned up the following: http://tolstoy.newcastle.edu.au/R/e6/help/09/03/9010.html ? Unfortunately, it does not address equations with numerators and demomenators.? ? Here is a guess (but this fails): ? ### Change spacing to allow for multiline title par(oma=c(2, 0, 4, 0)) ### Some greek letters mu <- 0 alpha <- 1 beta <- 2 delta <- 3 lambda <- 4 ### Some graph or other plot(1:10,1:10) mtext(expression(bold("Meaningless Title")), ????? line=3.5,cex=1.15) mtext(bquote(x == \frac{b +/- sqrt(b^2 - 4*a*c)}{2*a},?line=2.25,cex=1.15) ? ? Thanks again for any and all help.
Dennis Murphy
2010-Jan-21 22:36 UTC
[R] Displaying Equation With Numerator and Demomenator On A Plot...
Hi: Try this: plot(c(0, 1), c(0, 1)) text(0.5, 0.5, expression(x == over(-b %+-% sqrt(b^2 - 4 * a * c), 2 * a))) I've found it useful to print out the different plotmath expressions: pdf('plotmath.pdf') demo(plotmath) dev.off() HTH, Dennis On Thu, Jan 21, 2010 at 2:10 PM, Jason Rupert <jasonkrupert@yahoo.com>wrote:> Is there a way to display something like the quadratic equation, i.e. with > a numerator and demonator on a plot? > > I think there is a way to create the equation in Latex, but wasn't sure if > this format would translate to plotting. > > \begin{equation} > x = \frac{b +/- sqrt(b^2 - 4*a*c)}{2*a} > \end{equation} > > > My searched turned up the following: > http://tolstoy.newcastle.edu.au/R/e6/help/09/03/9010.html > > Unfortunately, it does not address equations with numerators and > demomenators. > > Here is a guess (but this fails): > > ### Change spacing to allow for multiline title > par(oma=c(2, 0, 4, 0)) > ### Some greek letters > mu <- 0 > alpha <- 1 > beta <- 2 > delta <- 3 > lambda <- 4 > ### Some graph or other > plot(1:10,1:10) > mtext(expression(bold("Meaningless Title")), > line=3.5,cex=1.15) > mtext(bquote(x == \frac{b +/- sqrt(b^2 - 4*a*c)}{2*a}, line=2.25,cex=1.15) > > > Thanks again for any and all help. > > > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]