When I plot my sklearn decision tree using sklearn.tree.plot_tree()
, the nodes are overlapping on the deeper levels and I cannot read what is in the nodes. It is not nice to present your results. It looks like this:
How can I achieve having more space between them, to avoid an overlap?
I already found this question, and I already increased the fontsize to 10 and figsize to (20,30), but it leads to the tree plotted as shown in the picture. I also increased dpi to 150. This is my code:
fig = plt.figure(figsize=(20,30))
artists = sklearn.tree.plot_tree(decision_tree=clf, feature_names=feature_names, class_names=class_names, filled=True, rounded=True, fontsize=10, max_depth=4)
fig.savefig(filepath, dpi=150)