This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Plot tree

treedisp will be removed in a future release. Use fitctree or fitrtree to grow a tree. Then use view (ClassificationTree) or view (RegressionTree) instead of treedisp.




treedisp(t) takes as input a decision tree t as computed by the treefit function, and displays it in a figure window. Each branch in the tree is labeled with its decision rule, and each terminal node is labeled with the predicted value for that node.

For each branch node, the left child node corresponds to the points that satisfy the condition, and the right child node corresponds to the points that do not satisfy the condition.

The Click to display pop-up menu at the top of the figure enables you to display more information about each node, as described in the following table.

Menu ChoiceDisplays

The node number, whether the node is a branch or a leaf, and the rule that governs the node

Variable ranges

The range of each of the predictor variables for that node

Node statistics

Descriptive statistics for the observations falling into this node

After you select the type of information you want, click any node to display the information for that node.

The Pruning level button displays the number of levels that have been cut from the tree and the number of levels in the unpruned tree. For example, 1 of 6 indicates that the unpruned tree has six levels, and that one level has been cut from the tree. Use the spin button to change the pruning level.

treedisp(t,param1,val1,param2,val2,...) specifies optional parameter name-value pairs, listed in the following table.


A cell array of names for the predictor variables, in the order in which they appear in the X matrix from which the tree was created (see treefit)


Initial pruning level to display


Create and graph classification tree for Fisher's iris data. The names in this example are abbreviations for the column contents (sepal length, sepal width, petal length, and petal width).

  load fisheriris;
  t = treefit(meas,species);
  treedisp(t,'names',{'SL' 'SW' 'PL' 'PW'});


[1] Breiman, L., J. Friedman, R. Olshen, and C. Stone. Classification and Regression Trees. Boca Raton, FL: CRC Press, 1984.

Introduced before R2006a

Was this topic helpful?