API Reference

API

Main functionality.

fieldmaps.apply_theme(*axes, grid=False)

Update one or more axes with the package theme.

Each axes is modified in place. If more than one is provided, they are returned as a flat array.

Parameters:
*axes : matplotlib Axes

Axes containing the plot(s) to be modified.

grid : bool, optional

Add gridlines to each axes. It is advised to leave this as False if using a 3rd-party theme (e.g. seaborn’s darkgrid).

Returns:
matplotlib Axes or array of Axes
fieldmaps.point_cont(data, coords, ax=None, palette='YlGn', lower=None, upper=None, **kwargs)

Plot a scatterplot map with continuous values.

Parameters:
data : one-dim sequence

Variable to be plotted. If the sequence is a masked array, masked values will be treated as missing data.

coords : array, shape (n, 2)

Array of coordinates, with the first column giving the x-coordinates and the second giving the y-coordinates.

ax : matplotlib Axes, optional

The axis onto which the plot will be drawn. If not provided, a new axis will be created.

palette : None or string, optional

Name of palette (colormap) to use or None to use the current palette. If not provided, the package’s default palette will be used.

lower : numeric, optional

If provided, the lower bound for which data should be displayed.

upper : numeric, optional

If provided, the upper bound for which data should be displayed.

kwargs

Keyword arguments to be passed to scatter.

Returns:
matplotlib Axes
fieldmaps.point_discrete(data, coords, ax=None, palette='tab20_woven', **kwargs)

Plot a scatterplot map with discrete values.

Parameters:
data : one-dim sequence

Variable to be plotted. If the sequence is a masked array, masked values will be treated as missing data.

coords : array, shape (n, 2)

Array of coordinates, with the first column giving the x-coordinates and the second giving the y-coordinates.

ax : matplotlib Axes, optional

The axis onto which the plot will be drawn. If not provided, a new axis will be created.

palette : None or string, optional

Name of palette (colormap) to use or None to use the current palette. If not provided, the package’s default palette will be used.

kwargs

Keyword arguments to be passed to scatter.

Returns:
matplotlib Axes
fieldmaps.poly_cont(data, verts, ax=None, palette='YlGn', lower=None, upper=None, **kwargs)

Plot a map from continous values tied to polygons.

Parameters:
data : one-dim sequence

Variable to be plotted. If the sequence is a masked array, masked values will be treated as missing data.

verts : sequence

Sequence of polygon coordinates. See matplotlib.collections.PolyCollection for more information.

ax : matplotlib Axes, optional

The axis onto which the plot will be drawn. If not provided, a new axis will be created.

palette : None or string, optional

Name of palette (colormap) to use or None to use the current palette. If not provided, the package’s default palette will be used.

lower : numeric, optional

If provided, the lower bound for which data should be displayed.

upper : numeric, optional

If provided, the upper bound for which data should be displayed.

kwargs

Keyword arguments to be passed to matplotlib.collections.PolyCollection.

Returns:
matplotlib Axes
fieldmaps.poly_discrete(data, verts, ax=None, palette='tab20_woven', **kwargs)

Plot a map from discrete values tied to polygons.

Parameters:
data : one-dim sequence

Variable to be plotted. If the sequence is a masked array, masked values will be treated as missing data.

verts : sequence

Sequence of polygon coordinates. See matplotlib.collections.PolyCollection for more information.

ax : matplotlib Axes, optional

The axis onto which the plot will be drawn. If not provided, a new axis will be created.

palette : None or string, optional

Name of palette (colormap) to use or None to use the current palette. If not provided, the package’s default palette will be used.

kwargs

Keyword arguments to be passed to matplotlib.collections.PolyCollection.

Returns:
matplotlib Axes
fieldmaps.raster_cont(data, ax=None, palette='YlGn', lower=None, upper=None, **kwargs)

Plot a raster with continuous values.

Parameters:
data : ndarray

Raster to be plotted. If the raster is a masked array, masked values will be treated as missing data.

ax : matplotlib Axes, optional

The axis onto which the plot will be drawn. If not provided, a new axis will be created.

palette : None or string, optional

Name of palette (colormap) to use or None to use the current palette. If not provided, the package’s default palette will be used.

lower : numeric, optional

If provided, the lower bound for which data should be displayed.

upper : numeric, optional

If provided, the upper bound for which data should be displayed.

kwargs

Keyword arguments to be passed to imshow.

Returns:
matplotlib Axes
fieldmaps.raster_discrete(data, ax=None, palette='tab20_woven', **kwargs)

Plot a raster with discrete data.

Parameters:
data : ndarray, shape (n, m)

Raster to be plotted. If the raster is a masked array, masked values will be treated as missing data.

ax : matplotlib Axes, optional

The axis onto which the plot will be drawn. If not provided, a new axis will be created.

palette : None or string, optional

Name of palette (colormap) to use or None to use the current palette. If not provided, the package’s default palette will be used.

kwargs

Keyword arguments to be passed to imshow.

Returns:
matplotlib Axes

Settings

Superficial default settings.

fieldmaps.settings.continuous_palette = 'YlGn'

Default color palette for continuous data.

fieldmaps.settings.alternate_palette = 'Blues'

Secondary color palette for continuous data.

fieldmaps.settings.discrete_palette = 'tab20_woven'

Default color palette for discrete data.