nxviz icon indicating copy to clipboard operation
nxviz copied to clipboard

Error when attempting to create Circos plot

Open thompske opened this issue 7 years ago • 3 comments

  • nxviz version: 2.1
  • Python version: 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]
  • Operating System: Windows 10
  • Browser: Firefox 61.0.1 (64-bit)

Description

Hi Eric, You saw this in person at the tutorial at SciPy, but here's a ticket for your reference. I get an error when trying to produce a Circos plot using the code in cell 3 from the notebook 4-cliques-triangles-structures-student.ipynb from the SciPy 2018 Network Analysis tutorial.

What I Did

# Make a Circos plot of the graph
from nxviz import CircosPlot

c = CircosPlot(G)
c.draw()

Yielded error:


AttributeError Traceback (most recent call last) in () 2 from nxviz import CircosPlot 3 ----> 4 c = CircosPlot(G) 5 c.draw()

C:\Users\Kelly\Anaconda3\lib\site-packages\nxviz\plots.py in init(self, graph, node_order, node_size, node_grouping, node_color, edge_width, edge_color, data_types, nodeprops, edgeprops) 183 node_color=node_color, edge_width=edge_width, 184 edge_color=edge_color, data_types=data_types, --> 185 nodeprops=nodeprops, edgeprops=edgeprops) 186 187 def compute_node_positions(self):

C:\Users\Kelly\Anaconda3\lib\site-packages\nxviz\plots.py in init(self, graph, node_order, node_size, node_grouping, node_color, edge_width, edge_color, data_types, nodeprops, edgeprops) 85 86 # Compute each node's positions. ---> 87 self.compute_node_positions() 88 89 def check_data_types(self, data_types):

C:\Users\Kelly\Anaconda3\lib\site-packages\nxviz\plots.py in compute_node_positions(self) 197 self.nodeprops['linewidth'] = radius * 0.01 198 for node in self.nodes: --> 199 x, y = get_cartesian(r=radius, theta=node_theta(self.nodes, node)) 200 xs.append(x) 201 ys.append(y)

C:\Users\Kelly\Anaconda3\lib\site-packages\nxviz\geometry.py in node_theta(nodelist, node) 13 assert node in nodelist, 'node must be inside nodelist.' 14 ---> 15 i = nodelist.index(node) 16 theta = -np.pi + i2np.pi/len(nodelist) 17

AttributeError: 'NodeView' object has no attribute 'index'

thompske avatar Jul 09 '18 15:07 thompske

This error could be because of a change in networkx version. In Networkx 2.1 for a graph G, G.nodes() is not a list hence "index doesn't" work.

ChakreshIITGN avatar Jul 18 '18 12:07 ChakreshIITGN

Thanks for pinging in, @ChakreshIITGN! Can you tell me your version of nxviz? In master, this bug should be fixed; however, if you're using an earlier version of nxviz, the incompatibility bug might still be around.

ericmjl avatar Jul 18 '18 13:07 ericmjl

Argh! I didn't read the ticket fully. My apologies!! Responding while in meetings is a very bad idea.

ericmjl avatar Jul 18 '18 13:07 ericmjl