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