class visigoth.map_layers.hexbin.Hexbin(data, lon=0, lat=1, hue=None, nr_bins_across=10, hue_manager=None, stroke='grey', stroke_width=1, draw_empty_bins=False, min_freq=1)
Create a Hexagonally binned plot of point density

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 (float or int) – Attach a magnitude value to each point (if None, all points are assigned a magnitude of 1)

  • nr_bins_across – number of hexagonal bins to arrange across the plot

  • hue_manager (ContinuousHueManager) – define the hues used in the plot

  • stroke (str) – the hue to use for bin lines

  • stroke_width (float) – the width (in pixels) to use for bin lines

  • draw_empty_bins (bool) – whether to draw hexagonal bins with zero value

  • min_freq (int) – only draw bins with this frequency or higher


(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 Box, Map
from visigoth.map_layers import Hexbin, Scatter
from visigoth.utils import ContinuousHueManager

d = Diagram(fill="white")

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

hue_manager = ContinuousHueManager(hueMap=["orange","purple"])

m1 = Map(512,bounds)

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

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