[R] plot cyrillic characters on MacOS X

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun May 13 07:36:57 CEST 2007


On Sat, 12 May 2007, Vlad Skvortsov wrote:

> Hi!
>
> I'm running R version 2.4.1 (2006-12-18) on MacOS X 10.4; my $LANG is
> ru_RU.KOI8-R.

But we are told that all locales on MacOS X are actually UTF-8: it will 
not matter as R knows the charset it is using.

> While trying to plot a graph to PDF with cyrillic characters in the
> legend, I get warnings (in Russian):
>
> > pdf()
> > plot(c(1), c(1), main="ÿÿÿÿÿÿÿÿ")
> Warning messages:
> 1: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 0xd4
> 2: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 0xc5
> 3: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 0xd3
> 4: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 0xd4
> 5: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 0xd4
> 6: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 0xc5
> 7: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 0xd3
> 8: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 0xd4
>
> (it's "width of character 0xZZ is unknown")
>
> The output PDF doesn't contain glyphs either.
>
> I've been looking through the docs to figure out what possible extra
> parameters I need to specify, but failed to see anything relevant.

>From the help page:

   family: the font family to be used, see 'postscript'.

encoding: the name of an encoding file.  See 'postscript' for details.

See also the article in R-News 2006-2 by Paul Murrell and myself with 
worked examples.  It is likely that family="URWHelvetica", 
encoding="KOI8-R" will work, but you may need to embed the font to display 
on the Adobe PDF reader (but not on ones based on GhostScript).

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