tracktable.render.histogram2d module

tracktable.render.histogram2d.cartesian(point_source, bbox_lowerleft, bbox_upperright, resolution=(400, 400), colormap='gist_heat', colorscale=matplotlib.colors.Normalize, axes=None, zorder=2)[source]

Draw a 2D histogram of points in a Cartesian space.

For the purposes of this function, a ‘point2d’ is a tuple or list at least 2 elements long whose first two elements are numbers.

Since we only traverse the point iterable once we require that you supply a bounding box. Any points outside this bounding box will be ignored.

Parameters
  • point_source (iterable) – Sequence of 2D points. This will be traversed only once.

  • bbox_lowerleft (point2d) – Lower left corner of bounding box for histogram

  • bbox_upperright (point2d) – Upper right corner of bounding box

Keyword Arguments
  • resolution (two integers) – Resolution for histogram

  • colormap (string or Colormap) – Colors to use for histogram

  • colorscale (matplotlib.colors.Normalize or subclass) – Mapping from bin counts to color. Useful values are matplotlib.colors.Normalize() and matplotlib.colors.LogNorm().

  • axes (matplotlib.axes.Axes) – Axes to render into. Defaults to “current axes” as defined by Matplotlib.

  • zorder (integer) – Image priority for rendering. Higher values will be rendered on top of actors with lower z-order.

Side Effects:

Actors will be added to the supplied axes.

Returns

A list of actors added to the Matplotlib figure.

tracktable.render.histogram2d.draw_density_array(density, map_projection, bounding_box, colormap=None, colorscale=None, zorder=10, axes=None)[source]
tracktable.render.histogram2d.geographic(map_projection, point_source, bin_size=1, colormap='gist_heat', colorscale=matplotlib.colors.Normalize, zorder=10, axes=None)[source]

Render a 2D histogram (heatmap) onto a geographic map

Parameters
  • mymap (Basemap) – Map to render onto

  • point_source (iterable) – Sequence of TrajectoryPoint objects

Kwargs:
bin_size (float): Histogram bins will be this many degrees on

each size. Defaults to 1.

colormap (string or Matplotlib colormap): Color map for

resulting image. Defaults to ‘gist_heat’.

colorscale (matplotlib.colors.Normalize or subclass): Mapping

from histogram bin count to color. Defaults to a linear mapping (matplotlib.colors.Normalize(). The other useful value is matplotlib.colors.LogNorm() for a logarithmic mapping. You can specify a range if you want to but by default it will be adapted to the data.

zorder (integer): Rendering priority for the histogram. Objects

with higher priority will be rendered on top of those with lower priority. Defaults to 2 (probably too low).

axes (matplotlib.axes.Axes): Axes instance to render into. If

no value is specified we will use the current axes as returned by pyplot.gca().

Returns

List of actors added to the axes

Side Effects:

Actors for the histogram will be added to the current Matplotlib figure.

Known Bugs:
  • The interface does not match the one for the Cartesian histogram. Most notably, you specify resolution explicitly for the Cartesian histogram and implicitly (via box size) for this one.

  • You can’t specify a histogram area that encloses the north or south pole.

  • You can’t specify a histogram area that crosses the longitude discontinuity at longitude = +/- 180. This should be relatively easy to fix.

tracktable.render.histogram2d.load_density_array(infile)[source]
tracktable.render.histogram2d.render_histogram(map_projection, point_source, bounding_box, bin_size=1, colormap='gist_heat', colorscale=matplotlib.colors.Normalize, zorder=10, axes=None)[source]
tracktable.render.histogram2d.save_density_array(density, outfile)[source]