2

I would like to change the text size of a node in rpart. The text does not fit into the box of the node if the text is too large. Still, there should be enough space.

rpart.plot(pruned_tree_model, type=0,tweak=1.5,leaf.round=0) 

are there some arguments to add?

Bukowski
  • 53
  • 1
  • 7

1 Answers1

1

you can actually change text size in nodes the same way you control text size in normal plot --- via the cex parameter:

library(rpart)
fit <- rpart(Mileage ~ Weight, car.test.frame)

par(mfrow = c(1, 2))
plot(fit)
text(fit)
plot(fit)
text(fit, cex = 0.5)

enter image description here

stas g
  • 1,503
  • 2
  • 10
  • 20