plot_map module
Visualization functions for GNSS data.
- plot_map._save_plotly(figures, titles=None, prefix='', fnames=None, width=730, height=520)[source]
Saves figures to file.
- Parameters:
figures (single or list of plotly.graph_objects.Figure objects to) – be saved.
titles (string, path-like or list of strings) – Titles for all plots.
prefix (string) – File prefix to add to filename.
fnames (single or list of string or path-like) – Path to save figure to. If not None,
fname
is passed directly to plotly’s write_image file parameter and prefix will be overwritten.width (int) – Figure width in pixels.
height (int) – Figure height in pixels.
- plot_map._write_plotly(figure, fname, width, height)[source]
Saves figure to file.
Automatically zooms out if plotly throws a ValueError when trying to zoom in too much.
- Parameters:
figure (plotly.graph_objects.Figure) – Object to save.
fname (string or path-like) – Path to save figure to.
width (int) – Figure width in pixels.
height (int) – Figure height in pixels.
- plot_map._zoom_center(lats, lons, width_to_height=1.25)[source]
Finds optimal zoom and centering for a plotly mapbox.
Assumed to use Mercator projection.
Temporary solution copied from stackoverflow [1] and awaiting official implementation [2].
- Parameters:
lons (array-like,) – Longitude component of each location.
lats (array-like) – Latitude component of each location.
width_to_height (float, expected ratio of final graph's width to) – height, used to select the constrained axis.
- Returns:
zoom (float) – Plotly zoom parameter from 1 to 20.
center (dict) – Position with ‘lon’ and ‘lat’ keys for cetner of map.
References
- plot_map.plot_map(*args, sections=0, save=False, prefix='', fname=None, width=730, height=520, **kwargs)[source]
Map lat/lon trajectories on map.
By increasing the
sections
parameter, it is possible to output multiple zoom sections of the trajectories to see finer details.- Parameters:
*args (gnss_lib_py.navdata.navdata.NavData) – Tuple of gnss_lib_py.navdata.navdata.NavData objects. The NavData objects should include row names for both latitude and longitude in the form of
`lat_*_deg
andlon_*_deg
. Must also includegps_millis
if sections >= 2.sections (int) – Number of zoomed in sections to make of data. Will only output additional plots if sections >= 2. Creates sections by equal timestamps using the
gps_millis
row.save (bool) – Save figure if true. Defaults to saving the figure in the Results folder.
prefix (string) – File prefix to add to filename.
fname (string or path-like) – Path to save figure to. If not None,
fname
is passed directly to matplotlib’s savefig fname parameter and prefix will be overwritten.width (int) – Figure width in pixels.
height (int) – Figure height in pixels.
mapbox_style (str) – Can optionally be included as one of the
**kwargs
Free options includeopen-street-map
,white-bg
,carto-positron
,carto-darkmatter
,stamen-terrain
,stamen-toner
, andstamen-watercolor
.
- Returns:
figs – Returns single plotly.graph_objects.Figure object if sections is <= 1, otherwise returns list of Figure objects containing full trajectory as well as zoomed in sections.
- Return type:
single or list of plotly.graph_objects.Figure