igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Problem with displaying vertex's label text in Chinese char


From: Tamás Nepusz
Subject: Re: [igraph] Problem with displaying vertex's label text in Chinese characters
Date: Sun, 3 Feb 2013 19:59:26 +0100

> I use python-igraph-0.7 on Ubuntu to draw graph.  To display the vertex's 
> text, I add its label attribute . As the text are Chinese characters of 
> 'unicode' type (not 'str' type),  I encode them by "UTF-8". But when the 
> graph is shown, the Chinese characters are show as the small squares, 
> unreadable codes. The fragment of my code list as follows:
> >>> g_labels = [n.encode('utf8') for n in g.vs['name']]
> >>> plot(g, mark_groups=True, vertex_label=g_labels)
> What's wrong with this?
The problem is that the default font in Cairo (the drawing library that igraph 
uses) does not support Chinese characters. You will have to find a TrueType 
font that has complete support for Chinese characters, and make Cairo use it 
somehow. I know it's possible because I've done that before (although not with 
igraph plots), so if you give me a few days, I'll try to dig up my old code and 
post it here.

-- 
Tamas


reply via email to

[Prev in Thread] Current Thread [Next in Thread]