sin*_*tor 5 python plot label matplotlib pandas
我正在制作一个简单的水平堆积条形图:
df = pd.DataFrame({'firstBox':firstL,'secondBox':secondL,'thirdBox':thirdL})
ax = df.plot.barh(stacked=True)
ax.set_title("My Example Plot")
ax.set_yticklabels(labels=['A label this long is cut off','this label is also cut off])
plt.show()
Run Code Online (Sandbox Code Playgroud)
但是我的 ytick 标签上的值被切断了。如果我增加返回的绘图窗口的宽度,我可以看到更多一些,但我需要将窗口拉伸到超过显示器的宽度才能看到整个标签。有没有办法将情节向右推以包含我的长标签?
谢谢!
Aar*_*nDT 11
你应该试试这个:
from matplotlib import rcParams
rcParams.update({'figure.autolayout': True})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2983 次 |
| 最近记录: |