ericmjl / nxviz

Visualization Package for NetworkX
https://ericmjl.github.io/nxviz
MIT License
451 stars 86 forks source link

MatrixPlot node_grouping issue #536

Closed vemvir closed 5 years ago

vemvir commented 5 years ago

Description

Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.

I'm doing the course on DataCamp regarding NetworkX Part 1, the last chapter with the case study on GitHub network data. I am also running this on my local machine as well and this is where I encounter the issue. I have managed to get to the Visualisation bit without any issues but when I try to replicate the MatrixPlot on my local machine the node_grouping

What I Did

# Import necessary modules
from nxviz import MatrixPlot
import matplotlib.pyplot as plt

# Calculate the largest connected component subgraph: largest_ccs
largest_ccs = sorted(nx.connected_component_subgraphs(G), key=lambda x: len(x))[-1]

# Create the customized MatrixPlot object: h
h = MatrixPlot(graph=largest_ccs, node_grouping='grouping')

# Draw the MatrixPlot to the screen
h.draw()
plt.show()

This results in a KeyError: 'grouping' on my local machine. Is there something I am doing wrong?

ericmjl commented 5 years ago

@vemvir one thing I think you'll need to do is to annotate each node with something that represents each connected component subgraph's ID.

Since this is coming from DataCamp, this shall be left as an exercise for the reader :).