繁体   English   中英

如何在pdf上绘制中文字符?

[英]How to plot chinese characters on pdf?

我的问题与我之前的问题有关。

如何在输入文件中绘制带有中文名称的条形图?

我需要在pdf上绘制现在的中文字符。

mydata = matrix( c( 2:6, c( 2,4,2,6,3 ) ), nrow= 2 )
mylabs = c( "木材", "表", "笔", "垃圾桶", "杯" )
barplot( mydata, beside=T, horiz= "T", names.arg= mylabs, las= 1, col= c( "red", "blue" ) )

pdf( "plotname.pdf" )
barplot( mydata, beside=T, horiz= "T", names.arg= mylabs, las= 1, col= c( "red", "blue" ) )
dev.off()

但仅在pdf ....打印而不是中文名称。

问候

尝试这个:

cairo_pdf( "plotname.pdf" )
barplot( mydata, beside=T, horiz= "T", names.arg= mylabs, las= 1, col= c( "red", "blue" ) )
dev.off()

我遇到了和你一样的问题(我在Mac上使用R 2.14.2和法语区域设置)。
我设法通过在pdf调用中指定字体系列“GB1”(简体中文)来解决:

pdf( "plotname.pdf" , family="GB1")
barplot( mydata, beside=T, horiz= "T", names.arg= mylabs, las= 1, col= c( "red", "blue" ) )
dev.off()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM