How can I change the figure size of xgboost's plot importance function?
Trying to pass a figsize=(10,20) fails with the exception of unknown attribute.
You can pass an axis in the ax
argument in plot_importance()
. For instance, use this wrapper:
def my_plot_importance(booster, figsize, **kwargs):
from matplotlib import pyplot as plt
from xgboost import plot_importance
fig, ax = plt.subplots(1,1,figsize=figsize)
return plot_importance(booster=booster, ax=ax, **kwargs)
Then use my_plot_importance()
instead of plot_importance()