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

Higher-level plotting methods for scale bar, map direction rose and magnetic rose? #2831

Open
seisman opened this issue Nov 26, 2023 · 2 comments
Labels
feature request New feature wanted

Comments

@seisman
Copy link
Member

seisman commented Nov 26, 2023

The basemap and coast modules provide the exactly same options for adding scale bars (-L), direction rose (-Td) and magnetic rose (-Tm) to maps.

I think it's more intuitive if we can provide three different higher-level plotting methods, e.g., Figure.scale_bar, Figure.direction_rose, Figure.magnatic_rose?

I'll take the Figure.scale_bar as an example. The -L full syntax is:

-L[g|j|J|n|x]refpoint+wlength[e|f|k|M|n|u][+aalign][+c[[slon/]slat]][+f][+jjustify][+l[label]][+odx[/dy]][+u][+v]

and the function definition will be like:

Figure.scale_bar(
   location=None,  # [g|j|J|n|x]refpoint
   length=None,  # +w
   label_alignment=None,  # +a
   scale_latitude=None, # +c
   scale_longitude=None,  # +c
   fancy=False,  # +f or style="plain" or "fancy"
   justification=None, # +j
   label=None,  # +l
   offset=None, # +o 
   unit=None, # +u
   vertical=None, # +v 
)

Of course, we also need to decide what to do with the box parameter.

Thoughts?

@seisman seisman added the feature request New feature wanted label Nov 26, 2023
@yvonnefroehlich
Copy link
Member

The basemap and coast modules provide the exactly same options for adding scale bars (-L), direction rose (-Td) and magnetic rose (-Tm) to maps.

I think it's more intuitive if we can provide three different higher-level plotting methods, e.g., Figure.scale_bar, Figure.direction_rose, Figure.magnatic_rose?

I agree that separate methods for scale bar, direction rose, and magnetic rose are more user-friendly. Especially they are easier to find for new users. I remember myself searching for a separate GMT module to add a scale bar (similar to adding a colorbar) until I figured out that this is included in the basemap module 😅.

Of course, we also need to decide what to do with the box parameter.

Hm. Is it possible to include box as a parameter within the new high-level method Figure.scale_bar (similar to Figure.legend or Figure.colorbar) even both box (-F) and scale_bar (-L) are currently parameters of Figure.basemap or Figure.coast?

@seisman
Copy link
Member Author

seisman commented Nov 27, 2023

Of course, we also need to decide what to do with the box parameter.

Hm. Is it possible to include box as a parameter within the new high-level method Figure.scale_bar (similar to Figure.legend or Figure.colorbar) even both box (-F) and scale_bar (-L) are currently parameters of Figure.basemap or Figure.coast?

Yes, but the box parameter's syntax (-F[d|l|t][+cclearances][+gfill][+i[[gap/]pen]][+p[pen]][+r[radius]][+s[[dx/dy/][shade]]]) is very non-Pythonic. Since it's a "common" option used in several modules, I feel it's reasonable to define a Box class.

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

No branches or pull requests

2 participants