Hi
Would like to supply a list of coluors to change colours of lines in Plotly Networkx Graph. With networkx it is possible to change the colours of lines by providing a list of edge colours to the graph. In my case I am creating a network correlation graph want to colour the edges by whether they are positive or negative correlations. For Networkx as follows
nx.draw(mst, with_labels=True, pos=nx.fruchterman_reingold_layout(mst),
node_size=80, node_color=“#e1575c”, edge_color=edge_colours, ALPHA = .8,K=8,
width=edge_width)
#Where edge_colours is a list that has a colour per edge[‘red’,‘green’,‘green’…]
For the plotly version
tracer = go.Scatter(x=Xedges, y=Yedges,
mode=‘lines’,
line=dict(color=‘grey’, width=3),
hoverinfo=‘none’,
showlegend=False)
changing colour to edge_colours gives the following.
*ValueError: *
Invalid value of type ‘builtins.list’ received for the ‘color’ property of scatter.line*
Received value: ['#9eccb7', '#ff0000', '#9eccb7', '#9eccb7', '#9eccb7', '#ff0000', '#9eccb7', '#9eccb7', '#9eccb7', '#ff0000', '#ff0000', '#9eccb7', '#ff0000', '#ff0000', '#9eccb7', '#ff0000', '#ff0000', '#9eccb7', '#9eccb7', '#9eccb7', '#9eccb7', '#ff0000', '#ff0000', '#ff0000', '#9eccb7', '#9eccb7', '#ff0000', '#9eccb7', '#ff0000', '#ff0000', '#9eccb7', '#9eccb7', '#9eccb7', '#9eccb7', '#9eccb7', '#ff0000', '#9eccb7', '#9eccb7', '#ff0000', '#9eccb7', '#9eccb7', '#9eccb7', '#9eccb7', '#9eccb7', '#ff0000', '#9eccb7', '#9eccb7', '#ff0000', '#9eccb7', '#9eccb7', '#9eccb7']*
The ‘color’ property is a color and may be specified as:*
- A hex string (e.g. '#ff0000')*
- An rgb/rgba string (e.g. 'rgb(255,0,0)')*
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')*
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')*
- A named CSS color:*
aliceblue, antiquewhite, aqua, aquamarine, azure,*
Is it possible to do this in plotly and if not will it be added as a feature in the future?
All help appreciated
Rose