Voronoi

class visigoth.map_layers.voronoi.Voronoi(data, lat=0, lon=1, colour=2, label=None, size=None, stroke='black', stroke_width=2, palette=None, marker_manager=None)

Create a Voronoi plot

Parameters:

data (list) – A relational data set (for example, list of dicts/lists/tuples describing each row)

Keyword Arguments:
 
  • lat (str or int) – Identify the column to provide the latitude value for each point
  • lon (str or int) – Identify the column to provide the longitude value for each point
  • colour (str or int) – Identify the column to provide the colour for each point
  • label (str or int) – Identify the column to provide the label for each point
  • size (str or int) – Identify the column to provide the size for each point
  • stroke (str) – stroke color for plotting boundaries
  • stroke_width (int) – stroke width for plotting boundaries
  • palette (object) – a ContinuousPalette or DiscretePalette instance to control chart colour
  • marker_manager (object) – a MarkerManager instance to control marker appearance

Example

(Link to open example in new tab):

Source Code (Link to Github):

# -*- coding: utf-8 -*-

import random

from visigoth import Diagram
from visigoth.containers import Map, Box
from visigoth.map_layers import Voronoi
from visigoth.utils.mapping import Projections

rng = random.Random()
data = [(rng.random(),rng.random(),i,"area(%d)"%(i)) for i in range(200)]

d = Diagram(fill="white")
m = Map(512,boundaries=((0.0,0.0),(1.0,1.0)),projection=Projections.ESPG_4326)
v = Voronoi(data,lat=0,lon=1,colour=2,label=3)
v.getMarkerManager().setDefaultRadius(5)
m.addLayer(v)
d.add(Box(m))

html = d.draw(format="html")

f = open("example.html", "w")
f.write(html)
f.close()