'Pydot creates graph with empty node next to root node

I'm trying to create an image of a decision tree using the pydot function graph_from_dot_data. Everything works fine, but the resulting image has an empty node next to the root node. Reproducible example -

from sklearn.datasets import load_iris
from sklearn import tree
import pydot
from IPython.display import Image

clf = DecisionTreeClassifier()
iris = load_iris()

clf = clf.fit(iris.data, iris.target)
graph = graph_from_dot_data(export_graphviz(clf))

Image(graph[0].create_png())

enter image description here

How can I produce a decision tree image without an empty node next to the root node?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source