[R] How to draw a per mille symbol?

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Sep 19 18:53:49 CEST 2006


On Tue, 19 Sep 2006, Gavin Simpson wrote:

> Dear list,
>
> Following advice posted to this list a while back by Prof Ripley [1], I
> have been trying to draw a per mille character [2] in an axis label.
>
> This should give the correct character:
>
> plot(1:10, ylab = "\u2030")
>
> but all I get is '"S'. I'm running linux (FC5) and have fonts installed
> that have the correct character (viewed in the Gnome character map at
> least).

On what device?  If X11, this is almost always a font selection issue.
Unicode support in X11 fonts is a complex issue that seems to vary with 
every minor update.

> I have also tried plotting to a pdf device with a font family that the
> character map tool shows I have a per mille glyph for, e.g.:

What does character map have to do with postscript fonts?

> pdf("~/tmp/test_per_mille.pdf", paper = "a4", family = "URWBookman")
> plot(1:10, ylab = "\u2030")
> dev.off()
>
> But all I get here is a period or a dot-like symbol.

But see the article in R-news 2006-2 about this.  All we can do for PDF is 
to use an appropriate 8-bit font map, or a CJK font.  It seems that e.g.
encoding="CP1251" works, even for Helvetica.

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