The solution of display chinese in seaborn plot
See original GitHub issueAs #829 and #592 said, the reason is “seaborn override default fonts specified in matplotlibrc configs”. Thus, you can set the default seaborn font style after import the seaborn as follows:
import seaborn as sns
sns.set_style("darkgrid",{"font.sans-serif":['simhei', 'Arial']})
The simhei is the chinese font, and make sure the simhei.ttf already in your “Lib\site-packages\matplotlib\mpl-data\fonts\ttf” folder.
This method just change the seaborn font setting temporarily, however I do not know how to do that permanently.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:14
- Comments:11
Top Results From Across the Web
Seaborn, Matplotlib, plot Chinese error - python - Stack Overflow
Try to set matplotlib font and then set seaborn.And make sure that font is available in your system.
Read more >How to plot a figure with Chinese Characters in label - Kaggle
When I draw a figure with Chinese Character (Japanese Kanji) and it doesn't work! ... Anyone know how to display the Kanji in...
Read more >How to Display Chinese Character in matplotlib - Beverly Wang
Method 2: There is another way to work around, too. Manually specify the font file location and set font properties and then specify...
Read more >Data Visualisation with Python: Seaborn and Scatter Plots
This course will teach you how to bring big data sets to life through data visualisation using the powerful Python programming language.
Read more >Chapter 37 Interview questions for data visualization
Seaborn helps data scientists create statistically and aesthetically appealing meaningful plots. The answer to this question varies based on the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks @githubzhanglei , it works fine under python 3, here is my result. Just to be sure to set mpl first and then set seaborn.
If still seeing error after putting SimHei.ttf into site-packages/matplotlib/mpl-data/fonts/ttf, you might try to clear font cache. For centos, just go to ~/.cache/matplotlib and remove cached font list file.