You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having an issue with the order edges are plotted with geom_edge_link() - I need them to respect the order of factor levels (factor cat below) and to have different widths according to value in strength.
I would expect edges to be plotted in "order" they appear in the edge list that feeds tbl_graph but that does not seem to be the case - what should be the expected behaviour?
Consider the following dataframe
from <- c("A","A","A","A","A","B","B","B","B","B","C","C","D","D","D","D","D","D","D","D","E","E","E","E","E","F","F","G","G","G","G","G","G")
to <- c("H","I","I","J","O","O","H","I","I","N","N","H","N","J","H","J","J","I","I","J","L","N","J","L","H","L","H","M","J","N","I","H","H")
cat <- c("weak","moderate","strong","v_strong","weak","moderate","strong","v_strong","weak","moderate","strong","v_strong","weak","weak","weak","weak","weak","weak","moderate","strong","v_strong","moderate","moderate","moderate","moderate","strong","v_strong","weak","weak","weak","weak","strong","v_strong")
strength <- c(0.7,1,0.4,0.9,0,0,0.2,0.4,0.2,0.6,0.5,0.3,1,0.5,0.6,0.2,0.5,0.7,1,0,0.2,0.8,0.5,0.4,0.1,0,0.7,0.2,0.5,0.7,0.3,0.4,0.6)
df <- data.frame(from, to, cat, strength)
Fwiw I have found that only geom_edge_link2 respects the ordering of a factor variable. If the values of an edge are factors you can control the order in which the edges are drawn by setting the order of the factor levels, but again only for geom_edge_link2.
Hi - great package! Thanks!
I'm having an issue with the order edges are plotted with geom_edge_link() - I need them to respect the order of factor levels (factor cat below) and to have different widths according to value in strength.
I would expect edges to be plotted in "order" they appear in the edge list that feeds tbl_graph but that does not seem to be the case - what should be the expected behaviour?
Consider the following dataframe
Order the level in factor 'cat'
edge list
edge.list <- df
node list
tbl_graph file
Netw <- tbl_graph(nodes = node.list, edges = edge.list)
plot it!
I get this:
However, I would expect the red edges (i.e. level "weak") to be in the 'back' and over all the other edges.
I tried different things but just don't understand if this is the expected behaviour and how I can obtain my desired output.
Thanks for your help!
The text was updated successfully, but these errors were encountered: