I have a tidy_igraph data network that I plot out. I want to however color a single node in the graph a distinct color from all others as it is the central point in the graph.
I did the following to make a tibble with a color column:
attending <- consult_igraph_tidy %>%
activate(nodes) %>%
filter(label == "Person_A") %>%
mutate(color = "purple") %>%
as_tibble()
Now I wanted to add a single node as a layer to the ggraph like so:
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")
)