Scatter

class visigoth.map_layers.scatter.Scatter(data, lon=0, lat=1, hue=None, label=None, size=None, hue_manager=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

  • hue (str or int) – Identify the column to define the point hue (use hue_manager default hue 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

  • hue_manager (object) – a ContinuousHueManager or DiscreteHueManager instance to control chart hue

  • 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.getHueManager().setDefaultHue("blue")
m1.add(scatter)
d.add(Box(m1))

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

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