Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change size of plot in xgboost.plot_importance?

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

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

like image 719
dsl1990 Avatar asked Nov 17 '16 20:11

dsl1990


1 Answers

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)
like image 55
tacaswell Avatar answered Sep 25 '22 05:09

tacaswell