Search code examples
rvisualizationrpart

changing font size in regression tree plot


library(rpart)
library(rpart.plot)
fit <- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis)
prp(fit, type = 4, extra = 101, leaf.round = 1, fallen.leaves = TRUE,
    varlen = 0, tweak = 0.8)

enter image description here

I'm trying to get the text to fit inside the rounded squares. I tried lowering the tweak and cex values, but it appears that the rounded squares get smaller along with the text. How can I make the font size smaller?


Solution

  • Try out this graphical package instead:

    library(maptree)
    draw.tree(fit,cex=3)
    

    Change cex to get different font sizes.