[R] How to handle Chinese [It seems Cyrillic] character in R plot?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Nov 29 17:14:00 CET 2012


Your subject line says Chinese!

On 29/11/2012 08:42, Manish Gupta wrote:
> Hi,
>
> I m working on R plot with Russian label but on windows (adobe) russian text
> are not visible. Do i need to install some package to view it.
>
>   pdf("sample.pdf",width = 6.6 ,height = 4.2,family= "URWHelvetica",
> encoding="KOI8-R")
>   x<-c(1,2,3,4,5)
>   y<-c(2,3,4,5,6)
>   xlable<-c("ручка","книга","часы","ложка","смотреть")
>   plot(x,y,xlab=xlable)
>   dev.off()

See ?pdf:

      If you see problems with PDF output, do remember that the problem
      is much more likely to be in your viewer than in R.  Try another
      viewer if possible.

The fonts include with the Adobe viewers do not cover Cyrillic (as the 
help in fact says).  It does work in poppler-based and gs-based viewers.

It is possible that you need to install a suitable language pack for 
your unstated Adobe viewer.

There are other devices for pdf, as the help says.  Seem if cairo_pdf() 
works on Windows.

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