Scatter

class visigoth.map_layers.scatter.Scatter(data, fill='grey', stroke='black', stroke_width=1, radius=5, marker=False)

Create a Scatter plot

Parameters

data (list) – list of (lon,lat) pairs to plot

Keyword Arguments
  • fill (str or function) – fill colour for circles

  • stroke (str) – stroke colour for circles representing points

  • stroke_width (int) – stroke width for circles representing points

  • radius (int) – radius of circles representing points

  • marker (bool) – plot a marker rather than circle

Example

Screenshot (Link to open SVG for interactive features):

../_images/example34.png

Source Code (Link to Github):


import os.path
import sys
import argparse
import random

from visigoth import Diagram
from visigoth.containers.map import Map
from visigoth.utils.mapping import Mapping
from visigoth.containers.box import Box
from visigoth.map_layers.scatter import Scatter

if __name__ == "__main__":

    parser = argparse.ArgumentParser()
    parser.add_argument("--outpath", help="path for output SVG", default="example.svg")
    args = parser.parse_args()

    d = Diagram(fill="white")

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

    m1 = Map(512,bounds)
    m1.addLayer(Scatter(data,fill="green"))
    d.add(Box(m1))

    svg = d.draw()

    f = open(args.outpath, "wb")
    f.write(svg)
    f.close()