如何更改xgboost.plot_importance中图的大小? [英] How to change size of plot in xgboost.plot_importance?

查看:691
本文介绍了如何更改xgboost.plot_importance中图的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

xgboost.plot_importance(model, importance_type='gain')

我无法更改此图的大小.我想将此图保存为适当的大小,以便可以在pdf中使用它.我想要类似figize

I am not able to change size of this plot. I want to save this figure with proper size so that I can use it in pdf. I want similar like figize

推荐答案

它看起来像plot_importance

It looks like plot_importance return an Axes object

ax = xgboost.plot_importance(...)
fig = ax.figure
fig.set_size_inches(h, w)

看起来您也可以在其中传递轴

It also looks like you can pass an axes in

fig, ax = plt.subplots(figsize=(h, w))
xgboost.plot_importance(..., ax=ax)

这篇关于如何更改xgboost.plot_importance中图的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆