I’m currently making a network visualization ; I started from this tutorial and after a few modifications, managed to obtain my figure. The point is that I want to color the edges according to some values, but here they are all of the same color. It deals with this Scatter object :
edge_trace = go.Scatter(
I loop on my values to fill the
edge_trace['y'] list of coordinates, and I tried to do the same with the
edge_trace[line]['color'] attribute instead of only specifying a single color. But it gave me an error. How can I do that ? Do I have to create a Scatter object for each edge of the graph ?
Unfortunately it’s not possible to change line colors within a single scatter trace. So you would need to use multiple traces.
Here are some notes for an approach to doing this that I think would be pretty efficient: https://github.com/plotly/plotly.py/issues/591#issuecomment-430187163
I would eventually love to have a dedicated graph/directed graph figure factory that would do this discretization under the hood. Let me know if you would be interested in helping out with it
Thank you for your answer ! I have modified my code to have distinct traces and it works now :). i’d like to help that kind of figure but unfortunately I think I’m too busy with my PhD right now !
@jmmease any updates since last year?
@jmmease all the tutorials I see specify how to set a scatter trace’s color for the markers. How do I set a scatter trace’s color for lines using continuous values? I can’t figure out how to make
@jmmease Is this a feature the plotly team might consider adding?