【问题标题】:qgraph: how to fix node positions when changing graph type?qgraph:更改图形类型时如何修复节点位置?
【发布时间】:2021-04-25 01:20:30
【问题描述】:

在 qgraph 中,您可以通过多种方式计算边缘权重。在本例中,我将使用 cor(原始相关)和 pcor(部分相关)。

注意节点位置在图表之间发生变化:

library(qgraph)
qgraph(cor(iris[, -5]),
       layout = "spring",
       labels = colnames(iris[, -5]),
       legend = F,
       graph = "cor")

qgraph(cor(iris[, -5]),
       layout = "spring",
       labels = colnames(iris[, -5]),
       legend = F,
       graph = "pcor")

在这种情况下,我想比较边缘,但是当您必须找到边缘时,这样做会困难得多,因为它移动了。有没有办法固定节点和边的位置,以便得到两个相同的图,唯一的变化是边宽?

【问题讨论】:

    标签: r nodes edges network-analysis


    【解决方案1】:

    我真的不明白为什么,但是使用参数layout = "groups" 成功了:

    qgraph(cor(iris[, -5]),
           layout = "groups",
           labels = colnames(iris[, -5]),
           legend = F,
           graph = "cor")
    qgraph(cor(iris[, -5]),
           layout = "groups",
           labels = colnames(iris[, -5]),
           legend = F,
           graph = "pcor")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-04
      • 1970-01-01
      • 1970-01-01
      • 2017-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多