You may have to change/scale the sizes of the font by using "cex" and
then to keep all labels within the plotting window, use "xpd=TRUE".
Like in



text(fit, use.n=TRUE, cex=0.8, xpd=TRUE)
Philip

--
A Smile costs Nothing But Rewards Everything
                                                              - Anonymous

Happiness is not perfected until it is shared
                                                              -Jane Porter      
  


--- On Wed, 2/25/09, David Winsemius <dwinsem...@comcast.net> wrote:
From: David Winsemius <dwinsem...@comcast.net>
Subject: Re: [R] how to label the branches of a tree
To: "Utkarsh Singhal" <utkar...@ambaresearch.com>
Cc: "R-help Forum" <r-help@r-project.org>
Date: Wednesday, February 25, 2009, 7:28 AM

When I execute that code, I get labels both on the branching points and at the
leaves of the tree. So I guess my reply is "cannot reproduce" or
"do not understand".  They are however not properly positioned and the
edges and bottoms of some of the labels are cut off, but that did not sound like
your question.

Using Mac OS X 10.5.6 and the ATT binary of R2.8.1. ‘rpart’ version 3.1-42.

--David Winsemius

Note:  your mailer is putting single quotes inside the enclosing angle brackets
so my mailer does not recognize the r-help address as a valid address. Since
this is the first time I have encountered this construction, I wonder if your
mailer is adhering to standards in its reply-to functions.



On Feb 25, 2009, at 1:19 AM, Utkarsh Singhal wrote:

> Hi,
> 
> 
> 
> I am using rpart package to fit classification trees.
> 
> 
> 
> library(rpart)
> 
> fit <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis)
> 
> plot(fit,uniform=T)
> 
> text(fit, use.n=TRUE)
> 
> 
> 
> But I am unable to label the branches (not the nodes) of the tree. Can
somebody help me out in this?
> 
> 
> 
> Thank you,
> 
> Regards
> 
> Utkarsh Singhal | Amba Research
> 
> Ph +91 80 3980 8017 | Mob +91 99 0295 8815
> 
> Bangalore * Colombo * London * New York * San José * Singapore *
www.ambaresearch.com  <mailto:utkar...@ambaresearch.com>
> 
> 
> 
> 
> 
> This e-mail may contain confidential and/or privileged i...{{dropped:13}}
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to