Plotting network data

share on google plus share on facebook share on twitter share on linkedin share via email

In this post, we will take a look at plotting network data with matplotlib.

01.import matplotlib.pyplot as plt
02.from mpl_toolkits.mplot3d import Axes3D
03. 
04.fig = plt.figure()
05.ax  = fig.gca(projection='3d')
06. 
07.for u, v in edges:
08.    ax.plot([vertices[u][0], vertices[v][0]],
09.           [vertices[u][1], vertices[v][1]],
10.           [vertices[u][2], vertices[v][2]], color='k')
11.for i in points:
12.    ax.scatter(vertices[i][0], vertices[i][1], vertices[i][2],
13.              color='r', s=30)
14. 
15.ax.scatter([0, 10], [0, 10], [0, 10], color='w', s=1)
16.ax.set_xlim([0, 10])
17.ax.set_ylim([0, 10])
18.ax.set_zlim([0, 10])
19.ax.set_aspect('equal')
20.plt.show()

saddle

Leave a response

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>