[R] foreign characters in R plots

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Aug 27 10:18:00 CEST 2001


On Mon, 27 Aug 2001, Jakub Fast wrote:

> Hi,
>
> I am sorry to bother you with such a (presumably) simple question, but I
> have spent a couple of hours browsing the net and R documentation and came
> up with no answer to it. My problem is that I need to use Latin2 (ISO8859-2)
> characters in my plots. Adding an encoding="..." parameter to the postscript
> function does not solve the problem, as the characters still don't show up.

I've just tried

postscript("latin2.ps", enc="ISOLatin2.enc")
par(pty="s")
plot(c(0,15), c(0,15), type="n", xlab="", ylab="")
title("Centred chars in ISO Latin2")
grid(15, 15, lty=1)
for(i in c(32:127, 160:255)) {
    x <- i %% 16
    y <- i %/% 16
    points(x, y, pch=i)
}

and apart from some missing centering information it looks like
a table of ISO Latin2 I looked up.

Now, it may well be that your idea of latin2 differs from that, in which
case you need to change "ISOLatin2.enc".  If so, can you let us know
so we can correct the file.

(BTW, I am assuming you do have a viewer with fonts that is capable of
showing the characters that you say are missing, but that's worth
checking. In the test above the .enc file shows what is not defined.
Mine has one missing)


> Then I tried to copy the standard X11 .afm latin2 fonts to R's font
> directory. This didn't help either. I guess I would have to somehow tell R
> to use those fonts (and: can I do it without actually knowing the font
> family name? I only know their filenames...). Another question related to

Use the form of the family argument that specifies 4 afm files.
However, `X11' afm files are probably not correct for postscript fonts,
and you still need to deal with encoding.

> the topic is whether it is possible to use postscript character names as
> escape sequences for particular characters within a string instead of using
> \xxx for ascii code?

No. PostScript only knows about encoded strings.

>
> I would be very greatful if anyone could help me.
>
> Thanks --
>
> Kuba Fast
>
>
>
> --
>
> OnetKomunikator - porozumiesz sie
> z innymi [ http://ok.onet.pl/instaluj.html ]
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list