R:更改绘图大小

R:更改绘图大小,r,plot,data-visualization,data-manipulation,decision-tree,R,Plot,Data Visualization,Data Manipulation,Decision Tree,我正在使用R编程语言。我使用“rpart”库运行了一个决策树函数: 这将返回以下绘图: 以及一些警告信息: 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

我正在使用R编程语言。我使用“rpart”库运行了一个决策树函数:

这将返回以下绘图:

以及一些警告信息:

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”库,否则我将尝试使用此库


谢谢

使用
xpd=TRUE
。另外,
cex=
可能有助于调整字体大小

plot(z.auto)
text(z.auto, use.n=TRUE, xpd=TRUE, cex=.8)

您可以使用
Crattle
软件包来绘制类似购物车的图形

library(rpart)
library(rpart.plot)
library(rattle)

z.auto <- rpart(Mileage ~ Weight, car.test.frame)
#Plotting using `rpart.plot` package
prp(z.auto, type = 1)

是否有办法确保绘图缩放到自动适合页面?使用“party”或“partykit”库是否更容易解决此问题?谢谢您的回复!我要过几分钟才能接受答案。这个聚会也可以吗?我试着用党的图书馆做一个阴谋,结果得到的只是一个大广场。ggplot2也可以这样做吗?谢谢你的帮助@对不起,我从来没用过聚会图书馆,谢谢!我会花更多的时间学习…如果可能的话,你能看看这个相关的问题吗?谢谢你的帮助@我知道了,但恐怕我不知道:)谢谢你的回复!正如我在问题中所解释的,很遗憾,我没有访问rpart.plot的权限。我也无法接触到摇铃。没有他们能做到这一点吗?谢谢
plot(z.auto)
text(z.auto, use.n=TRUE, xpd=TRUE, cex=.8)
library(rpart)
library(rpart.plot)
library(rattle)

z.auto <- rpart(Mileage ~ Weight, car.test.frame)
#Plotting using `rpart.plot` package
prp(z.auto, type = 1)
#Plotting using `rattle` package
fancyRpartPlot(z.auto)