Skip to content

expression()

7 messages · Javier Garcia-Pintado, Benilton Carvalho, Scionforbai +3 more

#
Hi,
I'm trying to use expression() to write a text to a graphic in the margin.

Using:

mtext(expression(beta),side=1,line=2)

writes a perfect beta greek character, but I need to add a subindex
"max", and I'm trying:

mtext(paste(expression(beta),"max"),side=1,line=2)

simply writes "beta max" in the plot.

Please, Could you tell me what I'm doing wrong?

By the way, is there a way to add Latex expressions to graphics? Then I
could use the Latex expression: $\beta_{\mathrm{max}}$. This also would
be very useful for me for more complex expressions in plots.

Best regards,

Javier
#
mtext(expression(beta[max]), side=1, line=2)

is it what you want?

b
On Dec 12, 2006, at 10:59 AM, javier garcia-pintado wrote:

            
#
Hallo,

for the first question:
mtext(expression(beta[max]),side=1,line=2)

and:
?plotmath
demo(plotmath)
for the second.

Hope it helped,
Scionforbai
#
Thanks you,
this works right.

I just would like to note one thing:
although I've found italic() in the help for plotmath and I can see that
the italic function:

mtext(expression(italic(beta)[max]),side=1,line=2)

does not work on the greek beta character.

Though not strictly necessary, this would be perfect for my plots, as I
use them for papers to be published.

Wishes,
Javier
------------------------------------------
Benilton Carvalho wrote:

  
    
#
On Wed, 13 Dec 2006, javier garcia-pintado wrote:

            
No, and there is no italic symbol font in the R graphics model so no means 
of plotting such a symbol.
#
Hi
javier garcia-pintado wrote:
Take a look at
http://www.stat.auckland.ac.nz/~paul/Talks/fonts.pdf
(and maybe http://www.stat.auckland.ac.nz/~paul/Talks/fonts.tar.gz)
especially the latter half on mathematical formulas in plots, which
shows an example of using TeX fonts in R plots.
It includes links to further materials and explanations.

Paul

  
    
#
On Tuesday 12 December 2006 07:59, javier garcia-pintado wrote:
Sorry, couldn't resist.

JD