[R] how to let R support Chinese fonts in charts?

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Mar 12 09:56:20 CET 2008


You need to tell us your OS: see the request in the posting guide for 
'at a minimum' the result of sessionInfo().

We also need to know what graphics device(s) you are intending to use.
For postscript or PDF, see the article by Paul Murrell and myself in R 
News 2006-2.

Note too that 'Chinese' isn't one language (most OSes have two separate 
ones for 'traditional' and 'simplified') and several encodings are used 
for each of those languages.  Some devices have separate 'Chinese Fonts' 
for the two languages.

On Wed, 12 Mar 2008, Samuel wrote:

> Hi everyone,
>
> I plotted a chart this morning, which should have Chinese lables for the
> points. I made the chart via:
> coordinates:
> angel77wq        360.61501    9.278135
> cngdsthuang1220 -278.74068   91.556843
> c国际米兰c       125.47369  -66.589461
> fszym2007       -174.86150  346.672588
> john_azyb_lee    -59.76965  -13.806237
> limu0089        -135.18684 -147.573071
> new枪手         -147.53176 -130.237810
> ouyangye1215     103.64392 -154.077046
> poleland          20.42025 -190.509781
> 一声不哭        -324.70414  300.982933
> 一脚抽射           6.99539 -102.055952
> 三天两句         674.25244  106.671916
> 九头斑马        -282.92130  -38.153908
> 伯纳乌南斗星    -115.72405 -263.611178
> 健哥傲视天下    -165.43261 -174.308852
> 八零后的天堂    -224.57776  332.793277
> 加泰的灵魂       139.53463   93.483387
> 劳尔冈萨累斯     -77.28240 -301.935448
> 四眉水手         627.93457  125.001091
> 国米露露         -72.13721  176.418576
>
> label:
> [1] "angel77wq"       "cngdsthuang1220" "c国际米兰c"      "fszym2007"
> [5] "john_azyb_lee"   "limu0089"        "new枪手"         "ouyangye1215"
> [9] "poleland"        "一声不哭"        "一脚抽射"        "三天两句"
> [13] "九头斑马"        "伯纳乌南斗星"    "健哥傲视天下"    "八零后的天堂"
> [17] "加泰的灵魂"      "劳尔冈萨累斯"    "四眉水手"        "国米露露"
>
> plot(coordinates,type='n')
> text(coordinates,labels)
>
> and then I got the chart looks like the attached one.

No attachment appeared -- see the posting guide for details of what might 
be accepted.

> I know should be the encoding problem,but I don't know where I can change
> it.
>
> any ideas on this will be greatly appreciated.
>
> Thanks in advance.
>
>
>
> -- 
> Samuel Wu
> http://webclipping.com.cn

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