Closed im-mengyuli closed 5 years ago
You need to load the font in the wordcloud function. It does not go through the matplotlib. That is why even if you can plot Chinese on matplotlib, the wordcloud is still problematic.
wc = wordcloud.WordCloud(background_color="white",max_words=3000,max_font_size=60, random_state=40)
Please refer to In [538]
of this notebok
Thanks a lot!
@ClioLI does this solve your issue? If so @ChicoXYC please merge to FAQ and leave pointers here.
Yes, the problem has been solved and Yucan said he will merge this to FAQ.
It is better to put into module-wordcloud
. In essence, it is the wordcloud
issue, not matplotlib
issue.
After the new FAQ page is created, you can link from module-matplotlib
to module-wordcloud
, leaving a message:
There is a similar issue about Chinese characters (CJK characters) when you use
wordcloud
. Please refer to this section for the solution.
We keep on improving categorisation and inter-linking between those topics.
Troubleshooting
Describe your environment
Describe your question
I want to make a wordcloud picture of Chinese words using matplotlib. But the output picture is garbled and Chinese words cannot display. Even I have tried the two potential solutions (### https://github.com/hupili/python-for-data-and-media-communication-gitbook/blob/7fad4125cbde74714dbe0da1f71649680d24d7ee/module-matplotlib.md and https://github.com/hupili/python-for-data-and-media-communication/blob/93ff76364e0374aaacf75f766efb4736d7a357b7/matplotlib-examples/Chinese%20Font.ipynb) in Github, they do not work.
The minimum code (snippet) to reproduce the issue
Please refer to the following link https://github.com/ClioLI/Thorny-issues-of-Python