帮我写一段决策树可视化的代码,节点的字体大小为20
时间: 2023-03-12 08:22:36 浏览: 67
from sklearn import tree
import matplotlib.pyplot as plt# 定义决策树的数据
features = [[0, 0], [1, 1]]
labels = [0, 1]# 创建决策树
clf = tree.DecisionTreeClassifier()
clf.fit(features, labels)# 画出决策树
plt.figure(figsize=(20, 12))
tree.plot_tree(clf, fontsize=20)
plt.show()