Plotting a decision tree with pydot

蹲街弑〆低调 提交于 2019-12-03 16:44:09

You need to explicitly add the nodes you create to the graph:

node_from = pydot.Node(from_name, label=from_label)
graph.add_node(node_from)

and

node_to = pydot.Node(to_name, label=to_label, shape='box')
graph.add_node(node_to)

otherwise the renderer won't see the names. graph.add_node() includes the node metadata in the generated .dot file.

With those graph.add_node() lines added, the result is:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!