Skip to content

Commit d102b60

Browse files
authored
DEP: remove long deprecated plot_map (#270)
1 parent 60f8d97 commit d102b60

File tree

5 files changed

+61
-195
lines changed

5 files changed

+61
-195
lines changed

contextily/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
import xyzservices.providers as providers
6-
from .place import Place, plot_map
6+
from .place import Place
77
from .tile import *
88
from .plotting import add_basemap, add_attribution
99

contextily/place.py

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""Tools for generating maps from a text search."""
2+
23
import geopy as gp
34
import numpy as np
45
import matplotlib.pyplot as plt
5-
import warnings
66

7-
from .tile import howmany, bounds2raster, bounds2img, _sm2ll, _calculate_zoom
7+
from .tile import howmany, bounds2raster, bounds2img, _calculate_zoom
88
from .plotting import INTERPOLATION, ZOOM, add_attribution
99
from . import providers
1010
from xyzservices import TileProvider
@@ -214,65 +214,3 @@ def __repr__(self):
214214
self.place, self.n_tiles, self.zoom, self.im.shape[:2]
215215
)
216216
return s
217-
218-
219-
def plot_map(
220-
place, bbox=None, title=None, ax=None, axis_off=True, latlon=True, attribution=None
221-
):
222-
"""Plot a map of the given place.
223-
224-
Parameters
225-
----------
226-
place : instance of Place or ndarray
227-
The map to plot. If an ndarray, this must be an image corresponding
228-
to a map. If an instance of ``Place``, the extent of the image and name
229-
will be inferred from the bounding box.
230-
ax : instance of matplotlib Axes object or None
231-
The axis on which to plot. If None, one will be created.
232-
axis_off : bool
233-
Whether to turn off the axis border and ticks before plotting.
234-
attribution : str
235-
[Optional. Default to standard `ATTRIBUTION`] Text to be added at the
236-
bottom of the axis.
237-
238-
Returns
239-
-------
240-
ax : instance of matplotlib Axes object or None
241-
The axis on the map is plotted.
242-
"""
243-
warnings.warn(
244-
(
245-
"The method `plot_map` is deprecated and will be removed from the"
246-
" library in future versions. Please use either `add_basemap` or"
247-
" the internal method `Place.plot`"
248-
),
249-
DeprecationWarning,
250-
)
251-
if not isinstance(place, Place):
252-
im = place
253-
bbox = bbox
254-
title = title
255-
else:
256-
im = place.im
257-
if bbox is None:
258-
bbox = place.bbox_map
259-
if latlon is True:
260-
# Convert w, s, e, n into lon/lat
261-
w, e, s, n = bbox
262-
w, s = _sm2ll(w, s)
263-
e, n = _sm2ll(e, n)
264-
bbox = [w, e, s, n]
265-
266-
title = place.place if title is None else title
267-
268-
if ax is None:
269-
fig, ax = plt.subplots(figsize=(15, 15))
270-
ax.imshow(im, extent=bbox)
271-
ax.set(xlabel="X", ylabel="Y")
272-
if title is not None:
273-
ax.set(title=title)
274-
if attribution:
275-
add_attribution(ax, attribution)
276-
if axis_off is True:
277-
ax.set_axis_off()
278-
return ax

docs/reference.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,3 @@ Geocoding and plotting places
3232

3333
.. automethod:: contextily.Place.plot
3434

35-
.. autofunction:: contextily.plot_map
36-

examples/plot_map.py

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)