Skip to main content

SVG Hiveplot Python API

Project description


`Hiveplots <>`_ are a nice way of visualizing
complex networks.

This library uses `svgwrite <>`_ to
programbatically create hiveplots.

.. image::

A short example

.. image::

Create a plot from a network, randomly selecting whichever axis to place 50 nodes.::

from pyveplot import *
import networkx, random

# a network
g = networkx.barabasi_albert_graph(50, 2)

# our hiveplot object
h = Hiveplot( 'short_example.svg')
# start end
axis0 = Axis( (200,200), (200,100), stroke="grey")
axis1 = Axis( (200,200), (300,300), stroke="blue")
axis2 = Axis( (200,200), (10,310), stroke="black")

h.axes = [ axis0, axis1, axis2 ]

# randomly distribute nodes in axes
for n in g.nodes():
node = Node(n)
random.choice( h.axes ).add_node( node, random.random() )

for e in g.edges():
if (e[0] in axis0.nodes) and (e[1] in axis1.nodes): # edges from axis0 to axis1
h.connect(axis0, e[0], 45,
axis1, e[1], -45,
fill='none', stroke_width='0.34', stroke_opacity='0.4',
elif (e[0] in axis0.nodes) and (e[1] in axis2.nodes): # edges from axis0 to axis2
h.connect(axis0, e[0], -45,
axis2, e[1], 45,
fill='none', stroke_width='0.34', stroke_opacity='0.4',
elif (e[0] in axis1.nodes) and (e[1] in axis2.nodes): # edges from axis1 to axis2
h.connect(axis1, e[0], 15,
axis2, e[1], -15,
fill='none', stroke_width='0.34', stroke_opacity='0.4',

The more elaborate shows how one can control the shapes of
nodes, the control points and attributes of edges, and the attributes
of axes.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pyveplot-0.2.tar.gz (3.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page