0

我有一个我绘制的 tidy_igraph 数据网络。但是,我想将图中的单个节点着色为与所有其他节点不同的颜色,因为它是图中的中心点。

我做了以下操作来制作一个带有颜色列的小标题:

attending <- consult_igraph_tidy %>%
    activate(nodes) %>%
    filter(label == "Person_A") %>%
    mutate(color = "purple") %>%
    as_tibble()

现在我想将单个节点作为图层添加到 ggraph,如下所示:

consult_igraph_tidy %>% 
    mutate(deg = degree(consult_igraph_tidy)) %>%
    activate(edges) %>%
    filter(Source_to_Target_Count >= 3) %>%
    activate(nodes) %>%
    filter(!node_is_isolated()) %>%
    mutate(friends = case_when(
        deg < 15 ~ "few"
        , deg < 25 ~ "medium"
        , TRUE ~ "most"
    )) %>%
    mutate(group = node_coreness(mode = "all")) %>%
    ggraph(layout = "fr") +
    geom_edge_link(
        aes(
            alpha = .618
        )
    ) +
    geom_node_point(
        aes(
            size = deg
            , color = factor(friends)
        )
    ) +
    geom_node_point( # the single point I want to add
        data = attending
        , aes(color = "purple")
    )
4

0 回答 0