У меня есть сеть данных 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")
)