Skip to content

Migrate the 'panel' parameter to the new alias system #4030

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

seisman
Copy link
Member

@seisman seisman commented Jul 30, 2025

As the PR title says.

@seisman seisman added this to the 0.17.0 milestone Jul 30, 2025
@seisman seisman added maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog needs review This PR has higher priority and needs review. labels Jul 30, 2025
@seisman seisman force-pushed the AliasSystem/panel branch from 49af570 to 7046f57 Compare July 30, 2025 11:03
@seisman seisman requested a review from Copilot July 30, 2025 11:27
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the 'panel' parameter from the old GMT parameter alias system to the new PyGMT alias system. The migration involves removing c="panel" from the use_alias decorator, removing c="sequence_comma" from kwargs_to_strings, adding panel=None as an explicit parameter, adding c=panel to the aliases documentation, and implementing the new AliasSystem with c=Alias(panel, name="panel", separator=",", size=2).

Key changes:

  • Removes old-style panel parameter handling from 23 plotting functions
  • Adds explicit panel parameters and new alias system implementation
  • Updates one subplot utility function to use direct parameter processing

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pygmt/src/wiggle.py Migrates panel parameter to new alias system for wiggle plots
pygmt/src/velo.py Migrates panel parameter to new alias system for velocity vector plots
pygmt/src/tilemap.py Migrates panel parameter to new alias system for tilemap plots
pygmt/src/text.py Migrates panel parameter to new alias system for text plotting
pygmt/src/ternary.py Migrates panel parameter to new alias system for ternary plots
pygmt/src/subplot.py Updates set_panel function to use direct parameter processing
pygmt/src/solar.py Migrates panel parameter to new alias system for solar plots
pygmt/src/rose.py Migrates panel parameter to new alias system for rose diagrams
pygmt/src/plot3d.py Migrates panel parameter to new alias system for 3D plots
pygmt/src/plot.py Migrates panel parameter to new alias system for 2D plots
pygmt/src/meca.py Migrates panel parameter to new alias system for focal mechanism plots
pygmt/src/logo.py Migrates panel parameter to new alias system for GMT logo
pygmt/src/legend.py Migrates panel parameter to new alias system for legend plotting
pygmt/src/image.py Migrates panel parameter to new alias system for image plotting
pygmt/src/histogram.py Migrates panel parameter to new alias system for histograms
pygmt/src/grdview.py Migrates panel parameter to new alias system for grid view plots
pygmt/src/grdimage.py Migrates panel parameter to new alias system for grid image plots
pygmt/src/grdcontour.py Migrates panel parameter to new alias system for grid contour plots
pygmt/src/contour.py Migrates panel parameter to new alias system for contour plots
pygmt/src/colorbar.py Migrates panel parameter to new alias system for colorbar plots
pygmt/src/coast.py Migrates panel parameter to new alias system for coastline plots
pygmt/src/basemap.py Migrates panel parameter to new alias system for basemap plots

@seisman seisman force-pushed the AliasSystem/panel branch from 7046f57 to ee00133 Compare July 31, 2025 08:40
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Jul 31, 2025
@@ -86,6 +86,7 @@ def basemap(self, projection=None, **kwargs):
self._activate_figure()
aliasdict = AliasSystem(
J=Alias(projection, name="projection"),
c=Alias(panel, name="panel", sep=",", size=2),
Copy link
Member Author

@seisman seisman Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm considering if we should define a function like:

def common_alias(value, name):
    match name:
        case "projection":
            return Alias(value, name="projection")
        case "panel":
            return Alias(value, name="panel", sep=",", size=2)

then in wrappers, we can use it like:

from pygmt.alias import common_alias
aliasdict = AliasSystem(
    J=common_alias(projection, name="projection"),
    c=common_alias(panel, name="panel"),
)

so that we don't have to repeat alias(panel, name="panel", sep=",", size=2), in all wrappers.

@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant