How to plot a figure with Chinese Characters in label
<p>When I draw a figure with Chinese Character label in Python 3, it doesn't work correctly:</p>

<p><img src="http://i.stack.imgur.com/k5zpP.png" alt="Screenshot">]</p>

<p><strong>My code:</strong></p>

<pre><code>fig = pd.DataFrame({
    'åºå¸æ¶çç':bond,
    'åºå¸ååºéæ¶çç':bondFunds,
    'è¢«å¨ææ°ååºéæ¶çç':indexFunds,
    'æ»æ¶çç':ret})
fig.plot()
plt.legend(loc=0)
plt.title('åºå¸æ¶çç',
          fontproperties='SimHei',
          fontsize='xx-large')
plt.grid(True)
plt.axis('tight')
</code></pre>

<p>You need to explicitly pass the font properties to <code>legend</code> function using the <code>prop</code> kwag:</p>

<pre><code>from matplotlib import font_manager

fontP = font_manager.FontProperties()
fontP.set_family('SimHei')
fontP.set_size(14)

fig = pd.DataFrame({
    'åºå¸æ¶çç':bond,
    'åºå¸ååºéæ¶çç':bondFunds,
    'è¢«å¨ææ°ååºéæ¶çç':indexFunds,
    'æ»æ¶çç':ret})
fig.plot()

# Note the next lines
plt.legend(loc=0, prop=fontP)
plt.title('åºå¸æ¶çç', fontproperties=fontP)

plt.grid(True)
plt.axis('tight')
</code></pre>

<hr>

<p><a href="https://pythonpath.wordpress.com/2013/09/16/chinese-in-matplotlib/" rel="nofollow">Source</a></p>

python python-3.x pandas matplotlib