Visualize a Network with Matplotlib

This section uses Matplotlib.

NetworkX is not aesthetically the best library for network visualization. In fact, it does not even do visualization on its own but uses services rendered by Matplotlib, a multipurpose graphics library. Luckily, the team of NetworkX and Matplotlib is fast and easy to understand, and the interaction with Matplotlib is well hidden from the network analyst; you do not need to learn yet another library—but still, you need to import it.

 import​ ​matplotlib.pyplot​ ​as​ ​plt

Note that you typically do not need the whole library, but just the submodule matplotlib.pyplot.

The process of network visualization consists of two phases: layout and rendering. At the layout phase, the ...

Get Complex Network Analysis in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.