操纵文本边缘标签ctree

操纵文本边缘标签ctree,r,data-visualization,party,R,Data Visualization,Party,有一个带有四个标签的携程,但是类别是长文本,因此只显示第一个 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;

有一个带有四个标签的携程,但是类别是长文本,因此只显示第一个

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)
类别;存在;比率测试;位于
回文递归;1.0;0;0
概念理解;0;1.0;0
缺氧综合征;0;0;1.0
外来语滥用;0;0;0;1.
回文递归;1.0;0;0
概念理解;0;1.0;0
缺氧综合征;0;0;1.0
外来语滥用;0;0;0;1.

concepts.ctree到目前为止,没有此选项。但是我刚刚调整了
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"
))
为了可视化,首先在x轴上创建一个具有足够大边距的视口。然后,将树添加到现有视口页面,并设置条形图的旋转/对齐参数

pushViewport(plotViewport(margins = c(6, 0, 0, 0)))
plot(concepts.ctree, tp_args = list(rot = 45, just = c("right", "top")),
  newpage = FALSE)

到目前为止,没有这方面的选项。但是我刚刚调整了
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"
))
为了可视化,首先在x轴上创建一个具有足够大边距的视口。然后,将树添加到现有视口页面,并设置条形图的旋转/对齐参数

pushViewport(plotViewport(margins = c(6, 0, 0, 0)))
plot(concepts.ctree, tp_args = list(rot = 45, just = c("right", "top")),
  newpage = FALSE)

改进版的
partykit
现在在R-Forge()上联机,可以按照答案中的说明安装。改进版的
partykit
现在在R-Forge()上联机,可以按照答案中的说明安装。