Re: [R] plot cyrillic characters on MacOS X

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sun, 13 May 2007 06:36:57 +0100 (BST)

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


______________________________________________ R-help_at_stat.math.ethz.ch 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.

Received on Sun 13 May 2007 - 05:43:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 May 2007 - 18:31:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.