[R] how to write symbol (nabla) in R graph

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jun 20 10:12:17 CEST 2008


On Fri, 20 Jun 2008, Dieter Menne wrote:

> Nuno Prista <nmprista <at> fc.ul.pt> writes:
>
>> Can anyone of you tell me how to write a "nabla" symbol in an R graph?

We need to know what is meant by 'nabla': 
http://en.wikipedia.org/wiki/Nabla_symbol tries to disambiguate.

> I have not tested it,

so others are left to find your errors for you.

> but according to
>
> http://www.gnu.org/software/plotutils/manual/html_chapter/plotutils_10.html
>
>
> nabla is Unicode [0321]

U+0321 is COMBINING PALATALIZED HOOK BELOW !  You have misread that 
document, which is about Hershey encodings not Unicode.

> Check documentation on plothmath how to use it.

Perhaps you meant ?Hershey ?

> Note: the documents cited in plotmath are huge, and it would be nice to have
> something like the gnu-reference I google for a short list.

Like the reference

http://www.stat.auckland.ac.nz/~paul/R/CM/AdobeSym.html

?  The Gnuplot reference you cite does qualify as 'huge' and you have 
demonstrated how unclear it is.  ?plotmath has both the definitive 
documentation and a reference to a short table (added by Paul Murrell at 
my suggestion).

Steve Ellison's answer is Unicode U+2207 via the symbol font.  That is 
'Nabla' (capitalized) according to

http://www.alanwood.net/unicode/mathematical_operators.html

although the Adobe glyph name is 'gradient'.


To summarize, do one of

Use \xd1 in font = 5

Use plotmath with symbol("\xd1") (or equivalent)

Use "\u2207" on systems that support UTF-8 (and with a font and graphics 
device that supports this).

E.g.

plot(1:5, type="n")
text(1,1, "\xd1", font=5)
text(2,2, expression(symbol("\xd1")))
text(3,3, "\u2207")

Depending on the locale and graphics device (and version of R) each of 
these may or may not work -- the first is probably the most reliable.

-- 
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