from sklearn import tree
from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
# load data
X, y = load_iris(return_X_y=True)
# create and train model
clf = tree.DecisionTreeClassifier(max_depth=4) # set hyperparameter
clf.fit(X, y)
# plot tree
plt.figure(figsize=(12,12)) # set plot size (denoted in inches)
tree.plot_tree(clf, fontsize=10)
plt.show()