xgb.plot_tree font size python

Edward picture Edward · May 20, 2016 · Viewed 9k times · Source

I make a picture as bellow

import matplotlib.pylab as plt
%matplotlib inline
from matplotlib.pylab import rcParams

..... i miss code for xgboost

xgb.plot_tree(clf, num_trees=2)

enter image description here

And i want to increase font size

font = {'size'   : 22}
plt.rc('font', **font)

or

plt.rcParams.update({'font.size': 32})

but font size is the same how to change font size in xgb.plot_tree?

Answer

Raywho picture Raywho · Mar 14, 2017
%matplotlib inline
from xgboost import plot_tree
from matplotlib.pylab import rcParams

##set up the parameters
rcParams['figure.figsize'] = 80,50

plot_tree(finalmodel, num_trees=X)

hope this will help, I think you should set up the matplotlib parameters first.