gps_data_analyzer.plot_utils module

gps_data_analyzer.plot_utils.add_annotated_points(ax, points, **kwargs)

Add annotated points to the given axis.

Parameters
  • ax (matplotlib.pyplot.Axes) – The axis object to update.

  • points (PoiPoints) – The points to add to the axis.

  • kwargs – The given kwargs will be passed to matplotlib.pyplot.annotate().

Note

The points object must be a pandas.DataFrame with the following columns:

  • x

  • y

  • name (optional): labels are taken if not provided

  • horizontalalignment (or ha) (optional): the default value is ‘center’

  • verticalalignment (or va) (optional): the default value is ‘center’

  • fontsize (optional): the default value is 12

  • x_offset (optional): the default value is 0

  • y_offset (optional): the default value is 0

gps_data_analyzer.plot_utils.create_transparent_cmap(name='rainbow')

Create a colormap with transparency for the lowest value.

Returns

The colormap.

Return type

matplotlib.colors.ListedColormap

gps_data_analyzer.plot_utils.plot(data, var=None, vmin=None, vmax=None, ax=None, show=True, projection=None, background=False, zoom=None, annotations=None, annotation_kwargs=None, border=0, extent=None, **kwargs)

Plot data with background and annotations.

Parameters
  • data (_GpsBase) – The object to plot.

  • var (str, optional) – The column used as plotted value.

  • vmin (float, optional) – The lower clipping value.

  • vmax (float, optional) – The upper clipping value.

  • ax (matplotlib.pyplot.Axes, optional) – The axis object to update.

  • show (bool, optional) – If true, call plt.show() else return the figure and axis objects.

  • projection (cartopy.crs.Projection, optional) – The projection of the axis (PlateCarree by default).

  • background (bool or cartopy.io.img_tiles.GoogleWTS, optional) – If true, a default background is added using Google Satellite. If a GoogleWTS object is given, it is used.

  • zoom (int, mandatory if background is not None) – The zoom value used to generate the background.

  • annotations (PoiPoints, optional) – The points used to annotate the figure.

  • annotation_kwargs (dict) – The kwargs passed to add_annotated_points().

  • border (float, optional) – The extra border around the data (not used if extent is given).

  • extent (Extent or list of float) – The extent to set.

  • kwargs – The given kwargs will be passed to pandas.DataFrame.plot().

Returns

The figure and axis if show is False, None otherwise.

gps_data_analyzer.plot_utils.plot_segments(gps_data, *args, **kwargs)

Plot segments with background and annotations.

Parameters

gps_data (_GpsBase) – The object to plot.

Note

The given object is converted into segments then plotted using plot().

gps_data_analyzer.plot_utils.setup_axis(ax=None, extent=None, projection=None, background=False, zoom=10)

Setup a matplotlib.pyplot.Axes instance.

Parameters
  • ax (matplotlib.pyplot.Axes, optional) – The axis object to update.

  • extent (Extent or list of float) – The extent to set.

  • projection (cartopy.crs.Projection, optional) – The projection of the axis (PlateCarree by default).

  • background (bool or cartopy.io.img_tiles.GoogleWTS, optional) – If true, a default background is added using Google Satellite. If a GoogleWTS object is given, it is used.

  • zoom (int, mandatory if background is not None) – The zoom value used to generate the background.