plot.rpart               package:rpart               R Documentation

_P_l_o_t _a_n _R_p_a_r_t _O_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     Plots an rpart object on the current graphics device.

_U_s_a_g_e:

     ## S3 method for class 'rpart':
     plot(x, uniform=FALSE, branch=1, compress=FALSE, nspace,
          margin=0, minbranch=.3, ...)

_A_r_g_u_m_e_n_t_s:

       x: a fitted object of class 'rpart', containing a
          classification, regression, or rate tree. 

 uniform: if 'TRUE', uniform vertical spacing of the nodes is used;
          this may be less cluttered when fitting a large plot onto a
          page. The default is to use a non-uniform spacing
          proportional to the  error in the fit. 

  branch: controls the shape of the branches from parent to child node.
          Any number from 0 to 1 is allowed.  A value of 1 gives square
          shouldered branches, a value of 0 give V shaped branches, 
          with other values being intermediate. 

compress: if 'FALSE', the leaf nodes will be at the horzontal plot
          coordinates of '1:nleaves'.   If 'TRUE', the routine attempts
          a more compact arrangement of the tree. The compaction
          algorithm assumes 'uniform=TRUE'; surprisingly, the result is
          usually an improvement even when that is not the case. 

  nspace: the amount of extra space between a node with children and a
          leaf, as compared to the minimal space between leaves.  
          Applies to compressed trees only.  The default is the value
          of 'branch'. 

  margin: an extra percentage of white space to leave around the
          borders of the tree. (Long labels sometimes get cut off by
          the default computation). 

minbranch: set the minimum length for a branch to 'minbranch' times the
          average branch length.  This parameter is ignored if
          'uniform=TRUE'. Sometimes a split will give very little
          improvement, or even (in the classification case) no
          improvement at all.   A tree with branch lengths strictly
          proportional to improvement leaves no room to squeeze in node
          labels. 

     ...: arguments to be passed to or from other methods. 

_D_e_t_a_i_l_s:

     This function is a method for the generic function 'plot', for
     objects of class 'rpart'. The y-coordinate of the top node of the
     tree will always be 1.

_V_a_l_u_e:

     the coordinates of the nodes are returned as a list, with
     components 'x' and 'y'.

_S_i_d_e _E_f_f_e_c_t_s:

     an unlabeled plot is produced on the current graphics device.

_S_e_e _A_l_s_o:

     'rpart', 'text.rpart'

_E_x_a_m_p_l_e_s:

     fit <- rpart(Price ~ Mileage + Type + Country, cu.summary)
     plot(fit, compress=TRUE)
     text(fit, use.n=TRUE)

