Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ha0ye opened this issue Aug 3, 2018 · 1 comment
Closed

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

ha0ye opened this issue Aug 3, 2018 · 1 comment

Comments

@ha0ye
Copy link

ha0ye commented Aug 3, 2018

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()
@ha0ye ha0ye changed the title start_cap ignored for self-edges? start_cap ignored in some cases if the graph contains self-edges? Aug 3, 2018
@malcolmbarrett
Copy link
Contributor

Interestingly, this issue seems not to apply to geom_edge_loop() but does on other edge geoms (I've tried geom_edge_link() and geom_edge_arc())

data.frame(from = c("a", "b"), 
                to = c("a", "c")) %>%
    igraph::graph_from_data_frame() %>%
    ggraph(layout = "circle") + 
    geom_edge_link(start_cap = circle(1), 
                  end_cap = circle(1), arrow = arrow()) +     
    geom_edge_loop(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()

Created on 2018-08-03 by the reprex
package
(v0.2.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants