python绘图调整字体
时间: 2024-01-25 14:12:47
浏览: 83
以下是Python matplotlib库中调整字体的方法和示例:
1. 统一设置字体、字体[大小](https://geek.csdn.net/educolumn/7261b874aa6b3f947468605f42946d95?spm=1055.2569.3001.10083)和字体粗细:
```python
import matplotlib.pyplot as plt
plt.rcParams['font.family'] = '[aria]([http](https://geek.csdn.net/educolumn/68f28ca3131d47699e5902c5d3d74d51?spm=1055.2569.3001.10083)s://geek.csdn.net/educolumn/463d440d0a4c351bc15e5ce55f37f0bb?spm=1055.2569.3001.10083)l' # 设置字体
plt.rcParams['font.size'] = 12 # 设置字体[大小](https://geek.csdn.net/educolumn/7261b874aa6b3f947468605f42946d95?spm=1055.2569.3001.10083)
plt.rcParams['font.weight'] = 'bold' # 设置字体粗细
plt.plot([1, 2, 3, 4], [1, 4, 9, 16])
plt.xlabel('X轴标签')
plt.ylabel('Y轴标签')
plt.title('[标题](https://geek.csdn.net/educolumn/7934305a779132dfb26adfb920ecce28?spm=1055.2569.3001.10083)')
plt.show()
```