Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 67 additions & 26 deletions pastastore/plotting/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ def stresses(
axes handle, if not provided a new figure is created.
figsize: tuple, optional
figure size, by default(10, 8)
backgroundmap: bool, optional
backgroundmap: bool or str, optional
if True, add background map (default CRS is EPSG:28992) with default tiles
by OpenStreetMap.Mapnik. Default option is False.
by OpenStreetMap.Mapnik. Default option is False. If str, it is passed as
map_provider to add_background_map method.
label_kwargs: dict, optional
dictionary with keyword arguments to pass to add_labels method
show_legend : bool, optional
Expand Down Expand Up @@ -203,7 +204,12 @@ def stresses(
ax.legend(loc=(0, 1), frameon=False, ncol=5)

if backgroundmap:
self.add_background_map(ax)
self.add_background_map(
ax,
map_provider=backgroundmap
if isinstance(backgroundmap, str)
else "OpenStreetMap.Mapnik",
)

return ax

Expand Down Expand Up @@ -233,9 +239,10 @@ def oseries(
automated smart label placement using adjustText, by default False
figsize: tuple, optional
figure size, by default(10, 8)
backgroundmap: bool, optional
backgroundmap: bool or str, optional
if True, add background map (default CRS is EPSG:28992) with default tiles
by OpenStreetMap.Mapnik. Default option is False.
by OpenStreetMap.Mapnik. Default option is False. If str, it is passed as
map_provider to add_background_map method.
label_kwargs: dict, optional
dictionary with keyword arguments to pass to add_labels method

Expand Down Expand Up @@ -267,7 +274,12 @@ def oseries(
self.add_labels(oseries, ax, adjust=adjust, **label_kwargs)

if backgroundmap:
self.add_background_map(ax)
self.add_background_map(
ax,
map_provider=backgroundmap
if isinstance(backgroundmap, str)
else "OpenStreetMap.Mapnik",
)

return ax

Expand All @@ -286,9 +298,10 @@ def models(
axes handle, if not provided a new figure is created.
figsize: tuple, optional
figure size, by default(10, 8)
backgroundmap: bool, optional
backgroundmap: bool or str, optional
if True, add background map (default CRS is EPSG:28992) with default tiles
by OpenStreetMap.Mapnik. Default option is False.
by OpenStreetMap.Mapnik. Default option is False. If str, it is passed as
map_provider to add_background_map method.

Returns
-------
Expand Down Expand Up @@ -318,7 +331,12 @@ def models(
self.add_labels(models, ax, adjust=adjust)

if backgroundmap:
self.add_background_map(ax)
self.add_background_map(
ax,
map_provider=backgroundmap
if isinstance(backgroundmap, str)
else "OpenStreetMap.Mapnik",
)

return ax

Expand Down Expand Up @@ -371,9 +389,10 @@ def series(
axes handle, if not provided a new figure is created.
figsize: tuple, optional
figure size, by default(10, 8)
backgroundmap: bool, optional
backgroundmap: bool or str, optional
if True, add background map (default CRS is EPSG:28992) with default tiles
by OpenStreetMap.Mapnik. Default option is False.
by OpenStreetMap.Mapnik. Default option is False. If str, it is passed as
map_provider to add_background_map method.
**kwargs: dict, optional
additional keyword arguments to pass to dataframe_scatter method.

Expand Down Expand Up @@ -491,9 +510,10 @@ def dataframe(
axes handle, if not provided a new figure is created.
figsize: tuple, optional
figuresize, by default(10, 8)
backgroundmap: bool, optional
backgroundmap: bool or str, optional
if True, add background map (default CRS is EPSG:28992) with default tiles
by OpenStreetMap.Mapnik. Default option is False.
by OpenStreetMap.Mapnik. Default option is False. If str, it is passed as
map_provider to add_background_map method.
progressbar: bool, optional
show progressbar, default is True.

Expand Down Expand Up @@ -549,7 +569,12 @@ def dataframe(
self.add_labels(df, ax, adjust=adjust)

if backgroundmap:
self.add_background_map(ax)
self.add_background_map(
ax,
map_provider=backgroundmap
if isinstance(backgroundmap, str)
else "OpenStreetMap.Mapnik",
)

return ax

Expand Down Expand Up @@ -592,9 +617,10 @@ def modelstat(
axes handle, if not provided a new figure is created.
figsize: tuple, optional
figuresize, by default(10, 8)
backgroundmap: bool, optional
backgroundmap: bool or str, optional
if True, add background map (default CRS is EPSG:28992) with default tiles
by OpenStreetMap.Mapnik. Default option is False.
by OpenStreetMap.Mapnik. Default option is False. If str, it is passed as
map_provider to add_background_map method.
progressbar: bool, optional
show progressbar, default is True.

Expand Down Expand Up @@ -675,9 +701,10 @@ def modelparam(
axes handle, if not provided a new figure is created.
figsize: tuple, optional
figuresize, by default(10, 8)
backgroundmap: bool, optional
backgroundmap: bool or str, optional
if True, add background map (default CRS is EPSG:28992) with default tiles
by OpenStreetMap.Mapnik. Default option is False.
by OpenStreetMap.Mapnik. Default option is False. If str, it is passed as
map_provider to add_background_map method.
progressbar: bool, optional
show progressbar, default is True

Expand Down Expand Up @@ -758,9 +785,10 @@ def signature(
axes handle, if not provided a new figure is created.
figsize: tuple, optional
figuresize, by default(10, 8)
backgroundmap: bool, optional
backgroundmap: bool or str, optional
if True, add background map (default CRS is EPSG:28992) with default tiles
by OpenStreetMap.Mapnik. Default option is False.
by OpenStreetMap.Mapnik. Default option is False. If str, it is passed as
map_provider to add_background_map method.
progressbar: bool, optional
show progressbar, default is True

Expand Down Expand Up @@ -938,9 +966,10 @@ def model(
axes handle, if not provided a new figure is created.
figsize: tuple, optional
figsize, default is (10, 10)
backgroundmap: bool, optional
backgroundmap: bool or str, optional
if True, add background map (default CRS is EPSG:28992) with default tiles
by OpenStreetMap.Mapnik. Default option is False.
by OpenStreetMap.Mapnik. Default option is False. If str, it is passed as
map_provider to add_background_map method.

Returns
-------
Expand Down Expand Up @@ -1080,7 +1109,12 @@ def model(
txt.set_path_effects(stroke)

if backgroundmap:
self.add_background_map(ax)
self.add_background_map(
ax,
map_provider=backgroundmap
if isinstance(backgroundmap, str)
else "OpenStreetMap.Mapnik",
)

fig.tight_layout()

Expand Down Expand Up @@ -1126,9 +1160,10 @@ def stresslinks(
adjust: bool, optional
automated smart label placement using adjustText, by
default False
backgroundmap: bool, optional
backgroundmap: bool or str, optional
if True, add background map (default CRS is EPSG:28992) with default tiles
by OpenStreetMap.Mapnik. Default option is False.
by OpenStreetMap.Mapnik. Default option is False. If str, it is passed as
map_provider to add_background_map method.

Returns
-------
Expand Down Expand Up @@ -1226,7 +1261,12 @@ def stresslinks(
ax.legend(handles=legend_elements)

if backgroundmap:
self.add_background_map(ax)
self.add_background_map(
ax,
map_provider=backgroundmap
if isinstance(backgroundmap, str)
else "OpenStreetMap.Mapnik",
)

return ax

Expand Down Expand Up @@ -1311,6 +1351,7 @@ def add_labels(
adjust_text(
texts,
objects=objects,
ax=ax,
force_text=(0.05, 0.10),
**{
"arrowprops": {
Expand Down