2016-09-03 5 views
0

私はUbuntu 14.04 Webサーバーをセットアップし、ロケールをzh_CN.UTF-8に変更しました。しかし、ggplot2はラベルに中国語文字を表示することはできません。ggplot2に中国語を表示

library(ggplot2) 
x_lab <- enc2utf8('中国') 
p <- ggplot(cars) + geom_point(aes(speed, dist)) + 
xlab(x_lab) 
png('a.png') 
print(p) 
dev.off() 

の結果は、この

enter image description here

この問題を解決するために、任意のアイデアのように見えますか?

PS:同じロケールの別のWebサーバーがありますが、うまく動作します。

これは、この問題は出て私のSessionInfo

> sessionInfo() 
R version 3.3.1 (2016-06-21) 
Platform: x86_64-pc-linux-gnu (64-bit) 
Running under: Ubuntu 14.04.5 LTS 

locale: 
[1] LC_CTYPE=zh_CN.UTF-8  LC_NUMERIC=C 
[3] LC_TIME=zh_CN.UTF-8  LC_COLLATE=zh_CN.UTF-8 
[5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8 
[7] LC_PAPER=zh_CN.UTF-8  LC_NAME=C 
[9] LC_ADDRESS=C    LC_TELEPHONE=C 
[11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C 

attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base 

other attached packages: 
[1] ggplot2_2.1.0 

loaded via a namespace (and not attached): 
[1] colorspace_1.2-6 scales_0.4.0  plyr_1.8.4  gtable_0.2.0 
[5] Rcpp_0.12.6  grid_3.3.1  munsell_0.4.3 

答えて

0

図です。私は新しいサーバーに中国語フォントをインストールする必要があり、その後、roboot:https://askubuntu.com/questions/490829/how-can-i-install-chinese-fonts-on-kubuntu-14-04

sudo apt-get install fonts-wqy-zenhei 
sudo apt-get install fonts-arphic-bkai00mp fonts-arphic-bsmi00lp fonts-arphic-gbsn00lp fonts-arphic-gkai00mp fonts-arphic-ukai fonts-arphic-uming fonts-cns11643-kai fonts-cns11643-sung fonts-cwtex-fs fonts-cwtex-heib fonts-cwtex-kai fonts-cwtex-ming fonts-cwtex-yen 

は、このページを参照してください。

関連する問題