0

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")
    )
MCP_infiltrator
  • 3,961
  • 10
  • 45
  • 82
  • Can you make a reproducible example? we can't help if we don't have your data or an example dataset to work with – see24 Feb 14 '20 at 20:18
  • I will work on one. I thought it would be as simple as selecting data like one would in ggplot2 where data = the item your interested in. like geom_point(data = data.frame(x = 0, y = 0), aes(color = "red"), size = 3) – MCP_infiltrator Feb 14 '20 at 20:47

0 Answers0