Skip to content

start_cap ignored in some cases if the graph contains self-edges? #150

@ha0ye

Description

@ha0ye

I noticed this while trying to add spacing between the nodes and edges in my figure and traced it back to whether there were self-edges (e.g. A -> A) in the graph.

For instance, contrast the output of

data.frame(from = c("a", "b"), 
                to = c("a", "c")) %>%
    graph_from_data_frame() %>%
    ggraph(layout = "circle") + 
    geom_edge_fan(start_cap = circle(1), 
                  end_cap = circle(1), arrow = arrow()) + 
    geom_node_circle(aes(r = 0.1)) + 
    geom_node_text(aes(label = name)) + 
    coord_fixed()

to

data.frame(from = c("a", "b"), 
                to = c("b", "c")) %>%
    graph_from_data_frame() %>%
    ggraph(layout = "circle") + 
    geom_edge_fan(start_cap = circle(1), 
                  end_cap = circle(1), arrow = arrow()) + 
    geom_node_circle(aes(r = 0.1)) + 
    geom_node_text(aes(label = name)) + 
    coord_fixed()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions