xgboost.plot_importance(model, importance_type='gain')
我无法更改这个图的大小。我希望以适当的大小保存这个图形,以便在PDF中使用。我想要类似于figsize
的效果
回答:
看起来plot_importance
返回一个Axes
对象
ax = xgboost.plot_importance(...)fig = ax.figurefig.set_size_inches(h, w)
看起来你也可以传入一个axes对象
fig, ax = plt.subplots(figsize=(h, w))xgboost.plot_importance(..., ax=ax)