Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding option to restrict ax extent to original one when using add_basemap #45

Closed
darribas opened this issue Nov 29, 2018 · 4 comments · Fixed by #38
Closed

Adding option to restrict ax extent to original one when using add_basemap #45

darribas opened this issue Nov 29, 2018 · 4 comments · Fixed by #38

Comments

@darribas
Copy link
Collaborator

When a user adds a basemap with add_basemap, the extent of the returned figure is automatically reset to fit that of the merged tiles. In some cases, this can render the original data in a too small part of the map. It'd be nice if add_basemap could take an argument reset_extent set to False by default to maintain original behaviour that made sure the outcoming figure had the same extent of the incoming ax object.

@ljwolf
Copy link
Member

ljwolf commented Nov 29, 2018

This resetting of extent also annoys me often when it happens...

Should be two lines to pull off the axis at the start and put it back on at the end.

@jorisvandenbossche
Copy link
Member

There is already a PR doing that :) https://github.com/darribas/contextily/pull/38 (it's what I originally did in the example added to the geopandas docs)

In that PR, I didn't make it an option, but just by default reset to the original extent.

If a user wants a bigger extent than its data, you can set the xlim/ylims first before calling add_basemap.

@jorisvandenbossche
Copy link
Member

(something else: we could maybe look into matplotlib APIs to see if it is possible to let it automatically re-draw (and thus also re-download tiles if needed) when the extent is changed, either programmatically, or in the interactive modus)

@darribas
Copy link
Collaborator Author

Quick update on this: I've had a look at #38 and looks good except an error that comes up on one test. I have also added the option to not reset the extent in case the user so wants (not the default). Once these two minor issues are ready to go, I'm happy to merge the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants