[R-SIG-Mac] Plotting Chinese characters
simon.urbanek at r-project.org
Wed Feb 9 23:03:52 CET 2011
you simply need a font that has those characters. For example on 10.6 this works:
plot.new(); plot.window(0:1,0:1); text(0.5,0.5,"精市",cex=10,family="Hei")
You may want to check your system for fonts that you can use (those that have chinese characters when you click on them in Font Book). There are a lot of fonts that work like STSong, STFangsong, LiSong Pro, AppleMyungjo, GungSeo etc.
On Feb 9, 2011, at 3:59 PM, Alberto Pepe wrote:
> (reposting here, from r-help, as requested)
> I have read some of the documentation relative to character encodings
> and non-standard fonts (including previous answered questions and the
> 2006-2 R issue), but I am still struggling with very basic plotting of
> Chinese text.
> I have a network, g, of Chinese characters (each node is a Chinese
> character) and I can handle it and display it fine within R using
> package igraph. However, when I try to plot this network, node names
> do not display in the plot. I am trying to produce a visualization of
> the character network, like this:
>> plot(g, layout=layout.fruchterman.reingold, vertex.color="black", vertex.size=2.0, edge.color="gray70", vertex.label=V(g)$name, edge.arrow.size=0.3)
> where g is a an igraph network:
> Vertices: 199
> Edges: 123
> Directed: TRUE
>  '精' -> '神'
>  '市' -> '场'
>  '思' -> '想'
> The names of the nodes (labels) do not display in the plot. I have
> noted that this is not a problem linked to igraph or network
> visualization. Even if I try to plot an empty chart with a title that
> contains one of the chinese characters above, these characters do not
> What is the simplest way to display these non-standard fonts in a R plot?
> I am using R for Mac OS X GUI 1.35-dev Leopard build 32-bit:
> R version 2.12.0 (2010-10-15)
> Platform: i386-apple-darwin9.8.0/i386 (32-bit)
>  en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> attached base packages:
>  grid tools stats graphics grDevices utils
> datasets methods base
> other attached packages:
>  igraph_0.5.5-1
> Alberto Pepe
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
More information about the R-SIG-Mac