garthtarr / edgebundleR

Circle plot with bundled edges
http://garthtarr.github.io/edgebundleR/
67 stars 12 forks source link

Specify colour for edges #9

Open garthtarr opened 7 years ago

garthtarr commented 7 years ago

From an email:

I am trying to assign colors to the edges, using groups and an igraph object; I am being able to make the assignments using the color names, but not with codes in hexadecimal. Is there any possible solution for this?

garthtarr commented 7 years ago

The colour of the edges is currently inherited from the "source" node. This is less than optimal, it would be nice to be able to specify the colour of the edges individually (e.g. read it from the edge colour properties of an igraph object).

garthtarr commented 7 years ago

There doesn't appear to be an issue specific to hex colour values. The colour interpretation is done using d3.color which takes hex or CSS named colours.

require(igraph)
require(edgebundleR)
ws_graph <- watts.strogatz.game(1, 50, 4, 0.05)
V(ws_graph)$color = sample(c("#ffeeaa","green","steelblue"),50,replace = TRUE)
edgebundle(ws_graph,tension = 0.1,fontsize = 18,padding=40)

I'll need to work out how to best address the edge colouring issue.

garthtarr commented 7 years ago

Perhaps we should be more ambitious and migrate to using the d3r package so that we can use the d3_igraph() function to convert igraph objects to JSON rather than using the very limited conversion function edgeToJSON_igraph() that we originally wrote. When we do this, we should incorporate the d3 dependency functions.

ghost commented 5 years ago

Hi, I have a igraph object, which some edges represents negative correlation and some represents positive correlation. I was wondering if there is a way to plot the edgebundle of it with two different color for different type of the edges. Thanks

garthtarr commented 5 years ago

Hi, I have to admit I haven't made any progress on this issue and am unlikely to in the near future. Happy to take pull requests though!