【问题标题】:rpart change text size in noderpart更改节点中的文本大小
【发布时间】:2016-03-10 08:33:57
【问题描述】:

我想更改 rpart 中节点的文本大小。 如果文本太大,则文本不适合节点的框。不过,应该有足够的空间。

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

有什么要补充的论据吗?

【问题讨论】:

    标签: r plot decision-tree rpart


    【解决方案1】:

    您实际上可以更改节点中的文本大小,就像在正常 plot 中控制文本大小一样——通过 cex 参数:

    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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-05
      • 1970-01-01
      相关资源
      最近更新 更多