Tools using Matplotlib
Given that it's has an easy and powerful API, Matplotlib is also used inside other programs and tools when plotting is needed. We are about to present a couple of these tools:
NetworkX
Mpmath
NetworkX
NetworkX (http://networkx.lanl.gov/) is a Python module that contains tools for creating and manipulating (complex) networks, also known as graphs.
A graph is defined as a set of nodes and edges where each edge is associated with two nodes. NetworkX also adds the possibility to associate properties to each node and edge.
NetworkX is not primarily a graph drawing package but, in collaboration with Matplotlib (and also with Graphviz), it's able to show the graph we're working on.
In the example we're going to propose, we will show how to create a random graph and draw it in a circular shape.
# matplotlib import matplotlib.pyplot as plt # networkx nodule import networkx as nx
In addition to pyplot
, we also import the networkx
module.
# prepare a random graph with n nodes and m...