更改matplotlib中的数字大小
这是我的代码,我想使剧情更大,以便更容易阅读。在这里,我试图基于杂质的平均减少而获得特征重要性。我得到了一些输出,但是由于我的Barplot有63个垃圾箱,所以我希望它更大。我尝试了所评论的所有内容。有人可以建议我如何使该栏图更可读吗?
import pandas as pd
from matplotlib.pyplot import figure
# fig.set_figheight(20)
# fig.set_figwidth(20)
#plt_1 = plt.figure(figsize=(20, 15), dpi = 100)
forest_importances = pd.Series(importances, index=feature_names)
fig, ax = plt.subplots()
forest_importances.plot.bar(yerr=std, ax=ax)
ax.set_title("Feature importances using MDI")
ax.set_ylabel("Mean decrease in impurity")
# fig = plt.figure()
fig.tight_layout()
plt.show()
This is my code and I want to make the plot bigger so it's easier to read. Here I'm trying to get feature importance based on mean decrease in impurity. I'm getting some output but since my barplot has 63 bins, I want it much bigger. I tried everything that is commented. Can someone please suggest how can I make this bar plot more readable?
import pandas as pd
from matplotlib.pyplot import figure
# fig.set_figheight(20)
# fig.set_figwidth(20)
#plt_1 = plt.figure(figsize=(20, 15), dpi = 100)
forest_importances = pd.Series(importances, index=feature_names)
fig, ax = plt.subplots()
forest_importances.plot.bar(yerr=std, ax=ax)
ax.set_title("Feature importances using MDI")
ax.set_ylabel("Mean decrease in impurity")
# fig = plt.figure()
fig.tight_layout()
plt.show()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
图.set_size_inches
plt.show()
:Use
fig.set_size_inches
beforeplt.show()
: