我的问题与我之前的问题有关。
How to plot bar plot with Chinese names in input file?
我现在需要在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上....而不是打印中文名称。
问候
发布于 2012-10-18 15:15:28
试试这个:
cairo_pdf( "plotname.pdf" )
barplot( mydata, beside=T, horiz= "T", names.arg= mylabs, las= 1, col= c( "red", "blue" ) )
dev.off()发布于 2012-10-18 15:47:01
我遇到了和你一样的问题(我用的是R2.14.2的Mac,地区设置是法语)。
我设法在pdf调用中指定了字体系列"GB1“(简体中文):
pdf( "plotname.pdf" , family="GB1")
barplot( mydata, beside=T, horiz= "T", names.arg= mylabs, las= 1, col= c( "red", "blue" ) )
dev.off()https://stackoverflow.com/questions/12948701
复制相似问题