即使没有自身优势,也绝对无法弄清楚为什么会出现错误。
下面是可复制的代码。任何帮助都会很棒

library(HiveR)


nodes = data.frame(id = 1:9, lab = c("A","B","C","E","F","G","H","I","J"),
axis = c(1,1,1,2,3,2,2,2,3), radius = rep(50,9),size = rep(10,9),
color = c("yellow","yellow","yellow", "green","red","green","green","green","red"))

edges = data.frame(id1 = c(1,2,3,4,5,4,1,9,8,6,1),id2 = c(2,3,4,1,9,9,9,8,7,7,6),
weight = rep(1,11),
color = c(rep("green",7), rep("red",4)))
        test3 <- ranHiveData(nx = 3)
        test3$nodes = nodes
        test3$edges = edges
        test3$edges$color <- as.character(test3$edges$color)
        test3$edges$id1 <- as.integer(test3$edges$id1)
        test3$edges$id2 <- as.integer(test3$edges$id2)
        test3$nodes$color <- as.character(test3$nodes$color)
        test3$nodes$lab <- as.character(test3$nodes$lab)
        test3$nodes$axis = as.integer(test3$nodes$axis)
        test3$nodes$id = as.integer(test3$nodes$id)
        test3$nodes$radius = as.numeric(test3$nodes$radius)
        test3$nodes$size = as.numeric(test3$nodes$size)
        test3$edges$weight = as.numeric(test3$edges$weight)
        test3$desc = "3 axes --9 nodes -- 11 edges"
        sumHPD(test3, chk.sm.pt = TRUE)


该代码给出了自身的边缘,并且该图未呈现plotHive(test3)显示


calcCurveGrob(x,x $ debug)中的错误:端点不能相同

最佳答案

在您的代码中,轴(radius)的节点的位置都设置为50。因此存在重叠点(轴1上为3,轴2上为4,轴3上为2)。
正确定义radius可以解决此问题。

library(HiveR)

# radius has been changed !
nodes = data.frame(id = 1:9, lab = c("A","B","C","E","F","G","H","I","J"),
axis = c(1,1,1,2,3,2,2,2,3), radius = c(1,2,3,1,1,2,3,4,2),size = rep(1,9),
color = c("yellow","yellow","yellow", "green","red","green","green","green","red"))

edges = data.frame(id1 = c(1,2,3,4,5,4,1,9,8,6,1),id2 = c(2,3,4,1,9,9,9,8,7,7,6),
weight = rep(1,11),
color = c(rep("green",7), rep("red",4)))
        test3 <- ranHiveData(nx = 3)
        test3$nodes = nodes
        test3$edges = edges
        test3$edges$color <- as.character(test3$edges$color)
        test3$edges$id1 <- as.integer(test3$edges$id1)
        test3$edges$id2 <- as.integer(test3$edges$id2)
        test3$nodes$color <- as.character(test3$nodes$color)
        test3$nodes$lab <- as.character(test3$nodes$lab)
        test3$nodes$axis = as.integer(test3$nodes$axis)
        test3$nodes$id = as.integer(test3$nodes$id)
        test3$nodes$radius = as.numeric(test3$nodes$radius)
        test3$nodes$size = as.numeric(test3$nodes$size)
        test3$edges$weight = as.numeric(test3$edges$weight)
        test3$desc = "3 axes --9 nodes -- 11 edges"
        sumHPD(test3, chk.sm.pt = TRUE)

plotHive(test3)


r -  hive 图中自身边缘的误差-LMLPHP

08-18 17:52