Towards new network graph visualisation – Python

Without much explanation, this is something which will help me work on a new layout algorithm to display my network graphs…

This is how you initiate the process of drawing the nodes and the edges, all I need to do next is figure out a way of calculating the coordinates for each based on a few parameters.

import matplotlib
import matplotlib.pyplot as plt

tuple_node_coords = ([1,1],

tuple_edges_coords = (([1,1],[2,2]),

# create the canvas
fig = plt.figure()
ax = fig.add_subplot(111)

# plot the edges first so that they apear behind the nodes.
# this looks more complicate than it should be because of the 
# way the plot function handels coordinate, in that you need 
# a full list for x and a full list for y, which is inconvenient  
# when writing the file...hence this loop
for each_coord in tuple_edges_coords:
    list_x_coords = []
    list_y_coords = []
    for coord_items in each_coord:
    # finally! plot the edges

# plot the nodes
for list_each_node in tuple_node_coords:

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s