Skip to content

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

Closed

Description

@seisman

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?

Activity

  1. added
    feature request
    on Nov 26, 2023
  2. yvonnefroehlich commented on Nov 26, 2023

    @yvonnefroehlich
    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?

  3. seisman commented on Nov 27, 2023

    @seisman
    MemberAuthor

    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.

  4. pinned this issue on May 6, 2024
  5. unpinned this issue on Aug 7, 2024
  6. added this to the 0.18.0 milestone on Dec 18, 2025
  7. seisman commented on Dec 18, 2025

    @seisman
    MemberAuthor

    We have decided to implement the three methods separately. The progress will be tracked in #4303, #4302, #4268.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature request

    Type

    No type

    Projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions