plot_tree#

plot_tree(node, ax=None, *, columns_names: list | None = None, class_names: list | None = None, scaler=None, float_precision: int | None = 3, max_depth: int | None = None, node_ids: bool = True, samples: bool = True, filled: bool = True, fontsize: float | None = None, colors: dict | None = None, wrap: int | None = None, show_media: bool = False)[source]#

Draw the subtree of a node with matplotlib. See RuleTree.plot_tree for the parameters.

Returns:

ax – The axes of the drawing. Each box is a text of ax.texts whose gid is the id of its node ("(...)" for the subtrees cut by max_depth); each medium is an axes of ax.child_axes whose gid is media-<node id>-<position> (true or false on the arrows).

Return type:

matplotlib.axes.Axes