我得到了一个有四个标签的ctree,但是类别是长文本,所以只显示了第一个。
category;presence;ratio;tested;located
palindromic_recursion;1;0;0;0
conceptual_comprehension;0;1;0;0
infoxication_syndrome;0;0;1;0
foreign_words_abuse;0;0;0;1
palindromic_recursion;1;0;0;0
conceptual_comprehension;0;1;0;0
infoxication_syndrome;0;0;1;0
foreign_words_abuse;0;0;0;1
concepts.ctree <- ctree(category ~., data)
plot(concepts.ctree)

是否有任何方法或参数用于操作(旋转)文本、边标签名称,并强制它们全部显示在绘图中?
我的真实数据要大得多,但这个样本可以测试它,如果你不使用缩放工具。
问候
发布于 2016-06-08 05:17:32
到目前为止,还没有这样的选择。但我刚刚调整了R-Forge上的partykit开发版本以支持此功能。目前,包正在重建,但希望你很快就能说install.packages("partykit", repos = "http://R-Forge.R-project.org") -或者如果你不想等那么长时间,只需检查SVN并重新构建自己。
在新版本中,您可以将rot和just参数传递给grid.text()以控制x轴标签的旋转和对齐。
读取数据:
data <- read.csv2(textConnection(
"category;presence;ratio;tested;located
palindromic_recursion;1;0;0;0
conceptual_comprehension;0;1;0;0
infoxication_syndrome;0;0;1;0
foreign_words_abuse;0;0;0;1
palindromic_recursion;1;0;0;0
conceptual_comprehension;0;1;0;0
infoxication_syndrome;0;0;1;0
foreign_words_abuse;0;0;0;1"
))拟合树(使用ctree()的partykit实现):
library("partykit")
concepts.ctree <- ctree(category ~ ., data = data)为了可视化,首先在x轴上创建一个具有足够大边距的视口。然后,将树添加到现有的viewport页面,并为条形图设置旋转/对齐参数。
pushViewport(plotViewport(margins = c(6, 0, 0, 0)))
plot(concepts.ctree, tp_args = list(rot = 45, just = c("right", "top")),
newpage = FALSE)

https://stackoverflow.com/questions/37680067
复制相似问题