Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion contextily/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import xyzservices.providers as providers
from .place import Place, plot_map
from .place import Place
from .tile import *
from .plotting import add_basemap, add_attribution

Expand Down
66 changes: 2 additions & 64 deletions contextily/place.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Tools for generating maps from a text search."""

import geopy as gp
import numpy as np
import matplotlib.pyplot as plt
import warnings

from .tile import howmany, bounds2raster, bounds2img, _sm2ll, _calculate_zoom
from .tile import howmany, bounds2raster, bounds2img, _calculate_zoom
from .plotting import INTERPOLATION, ZOOM, add_attribution
from . import providers
from xyzservices import TileProvider
Expand Down Expand Up @@ -214,65 +214,3 @@ def __repr__(self):
self.place, self.n_tiles, self.zoom, self.im.shape[:2]
)
return s


def plot_map(
place, bbox=None, title=None, ax=None, axis_off=True, latlon=True, attribution=None
):
"""Plot a map of the given place.

Parameters
----------
place : instance of Place or ndarray
The map to plot. If an ndarray, this must be an image corresponding
to a map. If an instance of ``Place``, the extent of the image and name
will be inferred from the bounding box.
ax : instance of matplotlib Axes object or None
The axis on which to plot. If None, one will be created.
axis_off : bool
Whether to turn off the axis border and ticks before plotting.
attribution : str
[Optional. Default to standard `ATTRIBUTION`] Text to be added at the
bottom of the axis.

Returns
-------
ax : instance of matplotlib Axes object or None
The axis on the map is plotted.
"""
warnings.warn(
(
"The method `plot_map` is deprecated and will be removed from the"
" library in future versions. Please use either `add_basemap` or"
" the internal method `Place.plot`"
),
DeprecationWarning,
)
if not isinstance(place, Place):
im = place
bbox = bbox
title = title
else:
im = place.im
if bbox is None:
bbox = place.bbox_map
if latlon is True:
# Convert w, s, e, n into lon/lat
w, e, s, n = bbox
w, s = _sm2ll(w, s)
e, n = _sm2ll(e, n)
bbox = [w, e, s, n]

title = place.place if title is None else title

if ax is None:
fig, ax = plt.subplots(figsize=(15, 15))
ax.imshow(im, extent=bbox)
ax.set(xlabel="X", ylabel="Y")
if title is not None:
ax.set(title=title)
if attribution:
add_attribution(ax, attribution)
if axis_off is True:
ax.set_axis_off()
return ax
2 changes: 0 additions & 2 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ Geocoding and plotting places

.. automethod:: contextily.Place.plot

.. autofunction:: contextily.plot_map

52 changes: 0 additions & 52 deletions examples/plot_map.py

This file was deleted.

Loading