[R] R-graphics printing greeks
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Oct 18 18:54:08 CEST 2007
You want a symbol, so
for (i in 1:10) text(7, order[i], as.name(greeks[i]))
(or as.symbol) gets you from character string to symbol.
BTW1: please check the code you post: yours doesn't work.
BTW2: the "o" is "omicron": you can see a list of the names at
http://www.stat.auckland.ac.nz/~paul/R/CM/AdobeSym.html
BTW3: these are mathematical Greek symbols, not modern Greek letters.
You get the latter a different way.
On Thu, 18 Oct 2007, Dan Avery wrote:
> I have tried to print a table of greek alphabet names and symbols
> without success. I can print one character at a time but can't seem to
> find a way to automate an entire list of the symbols. Some of the code I
> have tried is below. I have searched on help, worked the examples in the
> December 2002 R Help Desk article and plotmath but have not been able
> to find a way to accomplish the automation. There must be a way.
>
> Any help would be greatly appreciated.
>
> Thanks
>
> Dan Avery
>
> order<-seq(2,6.5,.5)
> greeks<-c( "alpha","beta","gamma","delta","epsilon", "zeta", "eta",
> "theta","iota" ,"kappa", "lambda" , "mu",
> "nu","xi","o","pi","rho","sigma","tau","upsilon","phi",chi", "psi" ,
> "omega" )
> plot(1:10,1:10,type="n")
>
> text(2,8,expression(alpha)) #this works
>
> for (i in 1:10) text(2,order[i],greeks[i])# produces a list of the first
> 10 names not the symbols
>
> for (i in 1:10) text(5,order[i],substitute(eval(greeks[i]))) #produces
> 10 instances of eval(greeks1)
>
> for (i in 1:10) text(7,order[i],substitute(greeks[i]))# produces 10
> instances of greeks1
>
> ______________________________________________
> R-help at 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.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list