Skip to content

DOC: Support dynamic filtering by tags for gallery examples with Sphinx-Gallery v0.21.0 #4599

Open

Description

@seisman

Sphinx-Gallery v0.21.0 introduces tag support for gallery examples, which allows examples to be tagged and filtered more effectively. See https://sphinx-gallery.github.io/stable/configuration.html#tagging-examples-and-filtering for the usage and https://sphinx-gallery.github.io/stable/auto_examples/index.html?#general-examples for a live demo.

This feature would be very beneficial for the PyGMT gallery, which has grown substantially and can be difficult to navigate, especially for new users. Tag support would allow:

  • Better discoverability of examples
  • More flexible navigation
  • Easier onboarding for new users
  • Improved documentation structure without major reorganization

Potential checklist

  • Decide if we want to support tags
  • Decide on the list of allowed tags for PyGMT
  • Document the list of allowed tags
  • Upgrade to Sphinx-Gallery ≥ 0.21.0
  • Add tags to gallery examples using the new tagging mechanism [definitely in multiple PRs]
  • See if we should reorganize the structure of the gallery
  • Update contributing guides

Activity

  1. added
    documentation
    discussions
    on Apr 24, 2026
  2. Chuan1937 commented on Apr 26, 2026

    @Chuan1937
    Member

    Sure, we should add tags. Such as:

    Tag Description
    maps Maps and map elements
    lines Lines and curves
    symbols Symbols and markers
    images Images and grids
    3d 3D plots
    seismology Seismology
    basemaps Basemaps (dual y-axis, ternary, etc.)
    histograms Histograms and rose diagrams
    embellishments Embellishments (colorbars, legends, etc.)
    projections Map projections
    beginner Beginner-friendly
    advanced Advanced
  3. yvonnefroehlich commented on May 6, 2026

    @yvonnefroehlich
    Member

    I agree that adding tags will make it easier to navigate through the examples.

    But I am still debating on the concept we should use for the labels. I believe it's not really helpful to use more or less the subsections we currently have also as labels. I am wondering if we can (additionally) have labels similar to the AGU24 workshop. Maybe we can have a look at the label concept used by matplotlib as inspiration.

  4. Chuan1937 commented on May 16, 2026

    @Chuan1937
    Member
  5. seisman commented on May 17, 2026

    @seisman
    MemberAuthor

    The AGU24 workshop uses labels based on module names, but I don’t think we need to add similar labels here.

    Such labels are mainly useful for finding examples that use a specific module, and we already provide that functionality on the API page for each module wrapper. For example, the examples using coast are already listed on the pygmt.Figure.coast API page.

  6. weiji14 commented on May 17, 2026

    @weiji14
    Member

    I believe it's not really helpful to use more or less the subsections we currently have also as labels. I am wondering if we can (additionally) have labels similar to the AGU24 workshop.

    I also think the Gallery Page is pretty well organized already by the subsections. Maybe we should start by adding tags for the Tutorial page at https://www.pygmt.org/v0.18.0/tutorials/index.html or the Projections page at https://www.pygmt.org/v0.18.0/projections/index.html instead?

    Personally I would like it if we can filter the Projections page by attributes such as:

    • equal-area (preserve correct area)
    • equidistant (preserve true distances)
    • conformal (preserve angles)

    Maybe start with these projection properties that are not so controversial, and then we can expand tags to other pages later?

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

    discussionsdocumentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions