Here’s the problem I was having: I use the English-language localisation of R, but for a couple of plots needed to include some Chinese text as well. I didn’t want to have to mess around with image editors, but wanted to output the graph as a pdf.
A call for help from my Sinophonic colleagues led to David C sending this:
library(grid)pdf(“chinese.pdf”, width = 10, height = 7)plot(1:10)grid.text(“華語”, y=7/8, gp=gpar(fontfamily=”CNS1″))grid.text( “is ‘chinese’ in (Traditional) Chinese”, y=6/8)grid.text(“华语”, y=5/8, gp=gpar(fontfamily=”GB1″))grid.text(“is ‘chinese’ in (Simplified) Chinese”, y=4/8)dev.off()
grid.text(“\u4F60\u597D”, y=2/3, gp=gpar(fontfamily=”CNS1″))