Visualizing a recursive partitioning tree
From the last recipe, we learned how to print the classification tree in a text format. To make the tree more readable, we can use the plot function to obtain a graphical display of a built classification tree.
Getting ready
One needs to have the previous recipe completed by generating a classification model, and to assign the model into the churn.rp variable.
How to do it...
Perform the following steps to visualize the classification tree:
- Use the 
plotfunction and thetextfunction to plot the classification tree: 
        > plot(churn.rp, margin= 0.1)
        > text(churn.rp, all=TRUE, use.n = TRUE)
The graphical display of a classification tree
- You can also specify the 
uniform,branch, andmarginparameter to adjust the layout: 
        > plot(churn.rp, uniform=TRUE, branch=0.6, margin=0.1)
        > text(churn.rp, all=TRUE, use.n = TRUE)
Adjust the layout of the classification tree
How it works...
Here, we demonstrate how to use the plot function...