NodeBox

Create visual output with Python programming code
Home Download Reference Tutorial Library Gallery About

Notwork (3)

Sample images: 1 2 3

This particular notwork monitors acts of terrorism from the start of the millenium. The algorithm reads the list of terrorist incidents from Wikipedia (using the NodeBox code package with the same name), and parses that to an XML list readable to the Notwork script.

 

 

Script

import wikipedia
body, links, url = wikipedia.search("list of terrorist incidents")

nodes = []
relevant = False
previous = ""

for tag, p in body:

if p == "2000s": relevant = True
if p == "See also": relevant = False
if relevant:
p = p.replace("\"", "'")
nodes.append("")
previous = p

font("Arial")
fontsize(8)
lineheight(0.8)

import network
xml = "\n".join(nodes)
network.map(xml, 0, 0, WIDTH, HEIGHT, radius=100)