Visualization

The visualization module provides a variety of functions to visualize initial, intermediate and final datasets within trackintel.

Positionfixes

trackintel.visualization.positionfixes.plot_positionfixes(positionfixes, out_filename=None, plot_osm=False, axis=None)[source]

Plots positionfixes (optionally to a file).

If you specify plot_osm=True this will use osmnx to plot streets below the positionfixes. Depending on the extent of your data, this might take a long time. The data gets transformed to wgs84 for the plotting.

Parameters
  • positionfixes (GeoDataFrame (as trackintel positionfixes)) – The positionfixes to plot.

  • out_filename (str, optional) – The file to plot to, if this is not set, the plot will simply be shown.

  • plot_osm (bool, default False) – If this is set to True, it will download an OSM street network and plot below the staypoints.

  • axis (matplotlib.pyplot.Artist, optional) – axis on which to draw the plot

Examples

>>> pfs.as_positionfixes.plot('output.png', plot_osm=True)
../_images/example_positionfixes.png

Staypoints

trackintel.visualization.staypoints.plot_staypoints(staypoints, out_filename=None, radius=100, positionfixes=None, plot_osm=False, axis=None)[source]

Plot staypoints (optionally to a file).

You can specify the radius with which each staypoint should be drawn, as well as if underlying positionfixes and OSM streets should be drawn. The data gets transformed to wgs84 for the plotting.

Parameters
  • staypoints (GeoDataFrame (as trackintel staypoints)) – The staypoints to plot.

  • out_filename (str, optional) – The file to plot to, if this is not set, the plot will simply be shown.

  • radius (float, default 100 (meter)) – The radius in meter with which circles around staypoints should be drawn.

  • positionfixes (GeoDataFrame (as trackintel positionfixes), optional) – If available, some positionfixes that can additionally be plotted.

  • plot_osm (bool, default False) – If this is set to True, it will download an OSM street network and plot below the staypoints.

  • axis (matplotlib.pyplot.Artist, optional) – axis on which to draw the plot

Examples

>>> sp.as_staypoints.plot('output.png', radius=100, positionfixes=pfs, plot_osm=True)
../_images/example_staypoints.png

Triplegs

trackintel.visualization.triplegs.plot_triplegs(triplegs, out_filename=None, positionfixes=None, staypoints=None, staypoints_radius=100, plot_osm=False, axis=None)[source]

Plot triplegs (optionally to a file).

You can specify several other datasets to be plotted beneath the triplegs, as well as if the OSM streets should be drawn. The data gets transformed to wgs84 for the plotting.

Parameters
  • triplegs (GeoDataFrame (as trackintel triplegs)) – The triplegs to plot.

  • out_filename (str, optional) – The file to plot to, if this is not set, the plot will simply be shown.

  • positionfixes (GeoDataFrame (as trackintel positionfixes), optional) – If available, some positionfixes that can additionally be plotted.

  • staypoints (GeoDataFrame (as trackintel staypoints), optional) – If available, some staypoints that can additionally be plotted.

  • staypoints_radius (float, default 100 (meter)) – The radius in meter with which circles around staypoints should be drawn.

  • plot_osm (bool, default False) – If this is set to True, it will download an OSM street network and plot below the triplegs.

  • axis (matplotlib.pyplot.Artist, optional) – axis on which to draw the plot

Example

>>> tpls.as_triplegs.plot('output.png', positionfixes=pfs, staypoints=sp, plot_osm=True)
../_images/example_triplegs.png

Locations

trackintel.visualization.locations.plot_locations(locations, out_filename=None, radius=150, positionfixes=None, staypoints=None, staypoints_radius=100, plot_osm=False, axis=None)[source]

Plot locations (optionally to a file).

Optionally, you can specify several other datasets to be plotted beneath the locations.

Parameters
  • locations (GeoDataFrame (as trackintel locations)) – The locations to plot.

  • out_filename (str, optional) – The file to plot to, if this is not set, the plot will simply be shown.

  • radius (float, default 150 (meter)) – The radius in meter with which circles around locations should be drawn.

  • positionfixes (GeoDataFrame (as trackintel positionfixes), optional) – If available, some positionfixes that can additionally be plotted.

  • staypoints (GeoDataFrame (as trackintel staypoints), optional) – If available, some staypoints that can additionally be plotted.

  • staypoints_radius (float, default 100 (meter)) – The radius in meter with which circles around staypoints should be drawn.

  • plot_osm (bool, default False) – If this is set to True, it will download an OSM street network and plot below the staypoints.

  • axis (matplotlib.pyplot.Artist, optional) – axis on which to draw the plot

Examples

>>> locs.as_locations.plot('output.png', radius=200, positionfixes=pfs, staypoints=sp, plot_osm=True)
../_images/example_locations.png