[R] How could plot a chart with some Chinese's words text?

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jun 30 08:43:50 CEST 2003


On Mon, 30 Jun 2003, Ken Lee wrote:

> Dear all,
>       I want to plot a chart title with some Chinese words at unix system, but I do not how to do.
> first, it is no problem when  I use write.table like:
>  
> a<-"中文"
> write.table(a,file="z.txt",sep="\t") 

Not, that is not Chinese for me and I suspect almost all your readers.

> second, I try 
> 
> bitmap(file="z.png")
> plot(1:10,main=a)
> dev.off()
> 
> I can't get a chart with the right title ="中文" 
> 
> Why have this difference?

Encodings.

bitmap(() uses postscript() and that is set up to use ISO-Latin1 on Unix.
You can change it (see its help file) provided your version of gs has the 
fonts you need.  It is almost certainly easier to use the png() device
*if* you can plot the title you want on an x11() device.

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