2016-03-03 134 views
0

我搜索互聯網,在matplotlib中找不到像在①中輸入特殊字符的任何內容。
是否有代碼表示要在圖中顯示的「①」?在matplotlib中繪製特殊字符①①

現在,我使用:

## the ① character was found on the Internet, and I clipped it. 
ax.text(0.425, 0.475, u'①', ha='center') 

我認爲必須有一些函數生成①,②,③,④......作爲一種特殊字符的

回答

4

帶圓圈的數字開始在Unicode碼點0x2460,至多到20所以只寫一個返回所需的字符一個小幫手功能:

def circled(x): 
    return chr(0x245F+x) # Python 2: use unichr() instead of chr() 

用法:

ax.text(0.425, 0.475, circled(1), ha='center') 
+0

非常感謝!它工作得很好。 –