我创建了一个径向树状图,但是看起来有些混乱,因为我的某些分支在4级结束,其他分支在5或6级。要解决此问题,我创建了空节点,但这是一种丑陋的技术,因为它们分散注意力,什么也没说。我的数据集如下:
Level1;Level2;Level3;Level4;Level5;Level6
Indo-European;Albanian;Gheg; ; ;Gheg Albanian
Indo-European;Albanian;Tosk; ; ;Arbereshe Albanian
Indo-European;Albanian;Tosk; ; ;Arvanitika Albanian
Indo-European;Albanian;Tosk; ; ;Tosk Albanian
Indo-European;Armenian; ; ; ;Armenian
Indo-European;Armenian; ; ; ;Western Armenian
Indo-European;Balto-Slavic;Slavic;South;Eastern;Bulgarian
Indo-European;Balto-Slavic;Slavic;South;Eastern;Macedonian
Indo-European;Balto-Slavic;Slavic;South;Eastern;Church Slavonic
这是我使用的代码:
courses <- read.csv("courses.csv", sep=";",header=TRUE, stringsAsFactors = FALSE)
head(courses)
str(courses)
library(data.tree)
courses$pathString <- paste("courses",courses$Level1,courses$Level2,courses$Level3,courses$Level4,courses$Level5,courses$Level6, sep= "|")
head(courses)
coursesTree <- as.Node(courses, pathDelimiter = "|")
coursesTree
coursesTreeList <- ToListExplicit(coursesTree, unname =TRUE)
library(networkD3)
radialNetwork(List=coursesTreeList,
fontSize = 13,
fontFamily = "OpenSans-Light",
nodeStroke = "orange",
opacity = 0.9)
是否有一种方法可以使它们都结束于6级而无需创建空节点?还是我至少可以单独说一句IF Node =“”的行,然后使其变得很小AND nodeStroke =“灰色” END以隐藏它们?