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

Add map scales, compasses, and missing basemap features #36

Closed
lukelbd opened this issue Sep 6, 2019 · 3 comments
Closed

Add map scales, compasses, and missing basemap features #36

lukelbd opened this issue Sep 6, 2019 · 3 comments
Labels
Milestone

Comments

@lukelbd
Copy link
Collaborator

lukelbd commented Sep 6, 2019

ProPlot should integrate with existing complex basemap features. For power users, this can be done by calling methods on ax.projection (which is the Basemap instance associated with the axes). But if we wanted to make things easier for users (in the spirit of ProPlot) we could add options to ProjectionAxes._format_apply as follows:

def _format_apply(
         ...
         etopo=None, bluemarble=None,
         mapscale=None, mapscale_kw=None,
         wmsimage=None, wmsimage_kw=None,
         warpimage=None, warpimage_kw=None,
         tissot=None, tissot_kw=None,
         patch_kw=None, **kwargs,
         ):
         """
         ...
         bluemarble : optional
             For basemap axes only. Draws the blue marble image.
         etopo : optional
             For basemap axes only. Draws topography data.
         mapscale, mapscale_kw : optional
             For basemap axes only. Draws a map scale.
         tissot, tissot_kw : optional
             For basemap axes only. Draws Tissot indicatrixes.
         warpimage, warpimage_kw : optional
             For basemap axes only. Adds arbitrary images to the background.
             See `~mpl_toolkits.basemap.Basemap.warpimage`.
         wmsimage, wmsimage_kw : optional
             For basemap axes only. Downloads and plots images using the WMS protocol.
             See `~mpl_toolkits.basemap.Basemap.warpimage`.
         ...
   """

Cartopy is missing several of these features, but distance scales could be implemented manually as discussed in this stackoverflow thread and this cartopy Github issue. This could be added to ProPlot ProjectionAxes, or to the cartopy project directly.

It would also be really interesting if we could add compasses to plots that show the Northward direction. This is not available in basemap or cartopy.

I'm not really motivated to address these proposals anytime soon but if someone else is, I think this is very doable for new contributors.

@lukelbd lukelbd added the feature label Sep 6, 2019
@lukelbd lukelbd changed the title Distance scales and compasses in ProjectionAxes Add more complex basemap features, add new cartopy features Jan 20, 2020
@lukelbd lukelbd changed the title Add more complex basemap features, add new cartopy features Add map scales, compasses, and missing basemap features May 19, 2020
@knaaptime
Copy link
Contributor

depending on your goals, contextily may also be worth considering here

@stefraynaud
Copy link
Contributor

I would suggest to implement it directly within Cartopy if it is already in Basemap.
I have an old compass working with basemap that I may be useful here or directly in cartopy, but I don't have time to adapt it. Here is the code: https://github.com/VACUMM/vacumm/blob/5d72cfd5314d9ba33d955c7c374903b8880d3c2c/lib/python/vacumm/misc/core_plot.py#L7637

@lukelbd lukelbd added this to the Version 0.10 milestone Jul 21, 2021
@lukelbd
Copy link
Collaborator Author

lukelbd commented Jan 24, 2022

I agree that these features belong in cartopy, not proplot. Also, I think all of these features (especially wmsimage, bluemarble, warpimage, and tissot) are specialized enough that they probably don't belong in GeoAxes.format() -- instead they should only be accessible via the standard cartopy interface.

For adding different backgrounds, the examples on this page or the GeoAxes.background_img() method could be used. For adding "tissot" indicators, there is apparently a GeoAxes.tissot() function. For adding map scales, we can monitor SciTools/cartopy#1728 or use the stackoverflow solution I posted above. For adding compasses, someone can start a new thread or use Stephane's solution posted above. And if you are a basemap holdout, you can simply use the basemap methods with e.g. ax.projection.drawmapscale() and ax.projection.tissot().

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

No branches or pull requests

3 participants