我正在使用R编程语言。我使用“ rpart”库运行了决策树函数:
library(rpart)
z.auto <- rpart(Mileage ~ Weight, car.test.frame)
从这里开始,我试图绘制结果:
plot(z.auto)
以及一些警告消息:
Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
"use.n" is not a graphical parameter
2: In doTryCatch(return(expr), name, parentenv, handler) :
"use.n" is not a graphical parameter
3: In doTryCatch(return(expr), name, parentenv, handler) :
"use.n" is not a graphical parameter
4: In doTryCatch(return(expr), name, parentenv, handler) :
"use.n" is not a graphical parameter
5: In doTryCatch(return(expr), name, parentenv, handler) :
"use.n" is not a graphical parameter
6: In doTryCatch(return(expr), name, parentenv, handler) :
"use.n" is not a graphical parameter
7: In doTryCatch(return(expr), name, parentenv, handler) :
"use.n" is not a graphical parameter
8: In doTryCatch(return(expr), name, parentenv, handler) :
"use.n" is not a graphical parameter
9: In doTryCatch(return(expr), name, parentenv, handler) :
"use.n" is not a graphical parameter
我正在尝试添加更多有关该图的信息(例如变量名称和决策规则)。我进行了一些研究,发现可以在此图中添加标签:
text(z.auto, use.n=TRUE)
这将返回以下图:
此图更好-但是文本被截断到底部。是否有一种直接的方法来更改绘图的内部大小,以使所有文本都显示而不会被截断?
注意:我使用的计算机没有Internet连接或USB端口-它只有R和一些常用库(例如ggplot2,rpart,party,partykit等),我无法安装“ rpart我的计算机上的“ .plot”库(https://www.rdocumentation.org/packages/rpart.plot/versions/3.0.9),否则我会尝试使用此库。
谢谢
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句