本文要点在于Python扩展库matplotlib的text()方法与annotate()的使用。...plt.figure(1, figsize=(8,8))
ax = plt.subplot(111)
def drawNode(text, startX, startY, endX, endY, ann):
#绘制带箭头的文本...", fc="r")
)
#在箭头中间位置标记数字
ax.text((startX+endX)/2, (startY+endY)/2, str(ann))
#绘制树根...dict(boxstyle="square,pad=0.3", fc="cyan", ec="b", lw=2)
ax.text(0.5, 0.97, 'A', bbox=bbox_props)
#绘制其他节点