Scatter

class visigoth.map_layers.scatter.Scatter(data, lon=0, lat=1, colour=None, label=None, size=None, palette=None, marker_manager=None)

Create a Scatter 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 define the point colour (use palette default colour if not specified)
  • label (str or int) – Identify the column to define the label
  • size (str or int) – Identify the column to determine the size of each marker
  • palette (object) – a ContinuousPalette or DiscretePalette instance to control chart colour
  • marker_manager (object) – a MarkerManager instance to control marker appearance
  • marker (bool) – plot a marker rather than circle

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 Scatter

rng = random.Random()
bounds = ((0,0),(1,1))
data = [(rng.random(),rng.random()) for x in range(0,200)]

d = Diagram()
m1 = Map(512,bounds)
scatter = Scatter(data,lon=0,lat=1)
scatter.getMarkerManager().setMarkerType("pin").setDefaultRadius(10)
scatter.getPalette().setDefaultColour("blue")
m1.addLayer(scatter)
d.add(Box(m1))

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

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