matplotlib添加宋体
时间: 2023-09-11 18:04:24 浏览: 112
Python如何使用内置库matplotlib绘制折线图
在使用Matplotlib库时,您可以通过以下代码设置字体为宋体:
```
config = {
"font.family": 'serif',
"font.serif": ['SimSun'],
}
rcParams.update(config)
```
这将使Matplotlib的字体变为宋体。您可以将这段代码添加到您的脚本中,然后重新运行你的程序,以确保字体更改生效。这样,您就可以在Matplotlib图表中使用宋体字体了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [matplotlib安装包](https://download.csdn.net/download/qq_20780541/86722104)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Python(matplotlib)画图设置正斜体,及中文宋体、英文Timenews--用于论文画图,导出高清晰图像](https://blog.csdn.net/qq_40214464/article/details/129908467)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文