nxviz
nxviz copied to clipboard
CircosPlot with networkx 2.4 (group_labels)
- nxviz version: 0.6.2
- networkx version: 2.4
- Python version: 3.7.3
- Operating System: Windows
Description
Hey, so. I upgraded my networkx today to 2.4 and since the CircosPlot group_label parameter stopped working. It was giving me an error on line 821, saying that "Graph doesn't have node" because of
[self.graph.node[n][self.node_color] for n in self.nodes])))
What I Did
I was able to solve it by tweaking the function in plots.py to the following:
sorted(list(set([list(self.graph.nodes.values())[n][self.node_color] for n in np.arange(len(self.nodes))])))
Now it works fine!! Legend for groups is generated fine!
Not sure if anyone else had this problem, but in case.. here is a possible solution!!
@eduardacenteno thanks a ton - yes, this is the correct fix.
Would you be open to submitting a PR to the library?
I've been gradually upgrading all of my NetworkX projects to v2.4 with this breaking change, but haven't had the bandwidth yet to make it over to nxviz.
@ericmjl
Sure, I'll fork it and submit a PR with the corrected version :)