Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def draw(self):
ax = plot.ax
if len(self.df.geometry) == 0:
return ax
basemap, extent = ctx.bounds2img(
*self._webmap_extent, zoom=self.zoom,
url=getattr(ctx.sources, provider), ll=True
)
extent = (extent[0], extent[1], extent[3], extent[2])
ax.imshow(basemap, extent=extent, interpolation='bilinear')
return ax
def add_basemap(ax, zoom, url='http://tile.stamen.com/terrain/tileZ/tileX/tileY.png'):
xmin, xmax, ymin, ymax = ax.axis()
basemap, extent = ctx.bounds2img(xmin, ymin, xmax, ymax, zoom=zoom, url=url)
ax.imshow(basemap, extent=extent, interpolation='bilinear')
# restore original x/y limits
ax.axis((xmin, xmax, ymin, ymax))