matplotlib:实现中文“宋体”,英文“Times New Rom”
操作系统是mac
- 安装simsun
- 下载字体SimHei.ttf SimSun.ttf
- 目录为/Users/xxx/.pyenv/versions/anaconda3-2020.02/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/ttf
- 如果报错:Font family ['sans-serif'] not found,那么通过代码
import matplotlib matplotlib.get_cachedir()找到缓冲文件目录,并删除之,然后重启jupyter,再然后修改/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc文件
font.family : sans-serif # 去掉前面的# font.sans-serif : SimHei, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif # 去掉前面的#,并在冒号后面添加SimHei axes.unicode_minus : False # 去掉前面的#,并将True改为False该部分参考了:https://blog.csdn.net/sinat_40875078/article/details/104326855

602

被折叠的 条评论
为什么被折叠?



