[R] Rpart plot produces no text
Achim Zeileis
Achim.Zeileis at uibk.ac.at
Wed Jun 29 14:27:49 CEST 2016
I don't think this is an RStudio issue. The plot() method for "rpart"
objects draws no labels. The text() method has to be called additionally:
library("rpart")
rp <- rpart(Species ~ ., data = iris)
plot(rp)
text(rp)
As these plots produced by rpart itself are not very appealing, there are
various approaches that allow drawing other displays, e.g.,
library("rpart.plot")
prp(rp)
library("rattle")
fancyRpartPlot(rp)
library("partykit")
plot(as.party(rp))
which show different amounts of detail and use different visual means to
display the available information.
On Wed, 29 Jun 2016, John Kane wrote:
> What happens if you run the code in a terminal rather than RStudio? My experience is that very, very occasionally RStudio does something a bit funny with plots.
>
> And while this may sound funny just shut down RStudio, reload it and try again.
>
> John Kane
> Kingston ON Canada
>
>
>> -----Original Message-----
>> From: jcthompson at redlobster.com
>> Sent: Tue, 28 Jun 2016 20:26:59 +0000
>> To: r-help at r-project.org
>> Subject: [R] Rpart plot produces no text
>>
>> I am using R Studio and am able to fit a tree with RPlot, however, the
>> tree in the viewer has no text (see image attached).
>>
>> Jim Thompson
>> This e-mail message is for the sole use of the intende...{{dropped:21}}
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
More information about the R-help
mailing list