FaC*_*fee 4 python matplotlib pandas subplot
说我有这个数据框:
Type Cat1 Cat2 Cat3
0 A 0.384000 0.393000 0.458000
1 B 0.603337 0.381470 0.299773
2 C 0.585797 0.452570 0.317607
3 D 0.324715 0.765212 0.717755
Run Code Online (Sandbox Code Playgroud)
我这样绘制(从这里开始):
axes = df.set_index('Type').plot.bar(subplots=True, legend=False)
plt.subplots_adjust(hspace=0.35)
Run Code Online (Sandbox Code Playgroud)
我的问题:如何ylim为每个子图设置不同的值?以及如何修改Cat标题的字体大小?
plotting方法返回axes变量中的轴数组。您可以访问每一个并设置标题和ylim。
axes = df.set_index('Type').plot.bar(subplots=True, legend=False)
plt.subplots_adjust(hspace=0.35)
axes[0].set_ylim(0, 1.1)
axes[0].set_title('hello')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
782 次 |
| 最近记录: |