###前提・実現したいこと
pythonのライブラリのwordcloudを使おうとしています.
参考にしている記事では,英文で作っていて,それは上手くできました.
しかし,日本語に対応したものを作りたいのですが,日本語は表示されません.
お力添えお願い致します.
よろしくお願い致します.
###発生している問題・エラーメッセージ
エラーはでないのですが,日本語が無視されて英語だけで表示されます.
以下が参考にしてかいたプログラムです.
python
1# coding: utf-8 2from wordcloud import WordCloud 3 4text = "Chief Justice Roberts, President Carter, President Clinton, President \ 5 Bush, President Obama, fellow Americans, and people of the world: \ 6 thank you. We, the citizens of America, are now joined in a great \ 7 national effort to rebuild our country and to restore its promise for \ 8 all of our people. \ 9 Together, we will determine the course of America and the world for \ 10 years to come. \ 11 We will face challenges. We will confront hardships. But we will get \ 12 the job done. \ 13 Every four years, we gather on these steps to carry out the orderly \ 14 and peaceful transfer of power, and we are grateful to President Obama \ 15 and First Lady Michelle Obama for their gracious aid throughout this \ 16 transition. They have been magnificent." 17 18#text = "あめ あめ あめ apple あめ apple あめ." 19 20fpath = "/Library/Fonts/ヒラギノ角ゴ Pro W3.otf" 21 22wordcloud = WordCloud(background_color="white",font_path=fpath, 23 width=800,height=600).generate(text) 24 25wordcloud.to_file("./wordcloud_sample2.png") 26
###試したこと
フォントパスの指定をしましたが,何も変わりませんでした.
###補足情報(言語/FW/ツール等のバージョンなど)
参考にしたページは下記のものです。
https://qiita.com/furipon/items/be97abf25cf4caa0574e
pythonのバージョンは2.7です。
OSはEl Capitanです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。