tracktable.render.backends.cartopy_backend module¶
Note
This module is used by render_trajectories
and render_heatmap
and shouldn’t be accessed directly.
Module contents¶
tracktable.render.cartopy - render trajectories in using the cartopy backend
- tracktable.render.backends.cartopy_backend.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 ints) – Resolution for histogram (Default: (400, 400))
colormap (str or Colormap) – Colors to use for histogram (Default: ‘gist_heat’)
colorscale (matplotlib.colors.Normalize or subclass) – Mapping from bin counts to color. Useful values are matplotlib.colors.Normalize() and matplotlib.colors.LogNorm(). (Default: matplotlib.colors.Normalize())
axes (matplotlib.axes.Axes) – Axes to render into. Defaults to “current axes” as defined by Matplotlib. (Default: None)
zorder (int) – Image priority for rendering. Higher values will be rendered on top of actors with lower z-order. (Default: 2)
- Side Effects:
Actors will be added to the supplied axes.
- Returns
A list of actors added to the Matplotlib figure.
- tracktable.render.backends.cartopy_backend.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
map_projection (Basemap) – Map to render onto
point_source (iterable) – Sequence of TrajectoryPoint objects
- Keyword Arguments
bin_size (float) – Histogram bins will be this many degrees on each size. Defaults to 1. (Default: 1)
colormap (str or Matplotlib colormap) – Color map for resulting image. Defaults to ‘gist_heat’. (Default: ‘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. (Default: matplotlib.colors.Normalize())
zorder (int) – 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). (Default: 10)
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(). (Default: None)
- 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.backends.cartopy_backend.render_heatmap(points, map_canvas=None, map_bbox=[], bin_size=1, colormap='gist_heat', colorscale=matplotlib.colors.Normalize, zorder=10, draw_lonlat=True, fill_land=True, fill_water=True, draw_coastlines=True, draw_countries=True, draw_states=True, map_projection=None, transform=cartopy.crs.PlateCarree, figsize=(4, 2.25), dpi=300, bbox_buffer=(0.3, 0.3), tiles=None, **kwargs)[source]¶
Render a histogram for the given map projection.
For documentation on the parameters, please see render_trajectories
- tracktable.render.backends.cartopy_backend.render_trajectories(trajectories, map_canvas=None, obj_ids=[], map_bbox=[], show_lines=True, gradient_hue=None, color_map='', line_color='', linewidth=0.8, show_points=False, point_size=0.2, point_color='', show_dot=True, dot_size=0.23, dot_color='white', trajectory_scalar_generator=<function path_length_fraction_generator>, trajectory_linewidth_generator=None, color_scale=matplotlib.colors.Normalize, show=True, save=False, filename='', tiles=None, show_distance_geometry=False, distance_geometry_depth=4, zoom_frac=[0, 1], draw_lonlat=True, fill_land=True, fill_water=True, draw_coastlines=True, draw_countries=True, draw_states=True, map_projection=None, transform=cartopy.crs.PlateCarree, figsize=(4, 2.25), dpi=300, bbox_buffer=(0.3, 0.3), **kwargs)[source]¶
Render a list of trajectories using the cartopy backend
For documentation on the parameters, please see render_trajectories