Skip to content

Migrate list-based frame settings to Frame/Axis syntax across examples and docs#4536

Open
Copilot wants to merge 11 commits intomainfrom
copilot/migrate-frame-settings-new-syntax
Open

Migrate list-based frame settings to Frame/Axis syntax across examples and docs#4536
Copilot wants to merge 11 commits intomainfrom
copilot/migrate-frame-settings-new-syntax

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

Many examples and docs still used legacy list-style frame=[...] arguments. This migrates them to the Frame/Axis classes from pygmt.params.

Before / After

# Before
frame=["WSne", "xaf+lDistance+u°", "ya4000+lElevation / m"]

# After
frame=Frame(
    axes="WSne",
    xaxis=Axis(annot=True, tick=True, label="Distance", unit="°"),
    yaxis=Axis(annot=4000, label="Elevation / m"),
)

# Complex secondary axes also migrated (date_time_charts.py)
frame=Frame(
    axes="WS",
    xaxis=Axis(annot="5d"),
    yaxis=Axis(annot=1, unit="cm"),
    xaxis2=Axis(annot="1O", tick="1D"),
    yaxis2=Axis(label="Length"),
)

Files changed

  • Gallery exampleslines/, symbols/, images/, seismology/
  • Intro & projections01_first_figure.py, 03_figure_element.py, cartesian_*.py, polar.py
  • Tutorialsframes.py, text.py, subplots.py, non_ascii_text.py, grid_equalization.py, cartesian_histograms.py, date_time_charts.py
  • Source docstringshelpers/testing.py, src/grdview.py, src/colorbar.py
  • Teststest_basemap.py, test_geopandas.py, test_grdview.py, test_config.py (simple patterns only)

Intentionally left as lists

File Reason
test_alias_system.py Tests backward compat of list syntax
ternary.py, test_ternary.py Ternary a/b/c axes unsupported in Frame/Axis
test_basemap.py frame=[True, "WSen"] Regression test for mixed bool+string list (#3981)
test_config.py pa1K/sa1K/pa1Hg/sa45mg45m "Primary/secondary all-axes" notation has no Frame equivalent

Copilot AI and others added 6 commits April 11, 2026 02:15
…amples

Replace list-style frame arguments with structured Frame and Axis class
instances from pygmt.params in:
- examples/gallery/lines/hlines_vlines.py
- examples/gallery/lines/connection_lines.py
- examples/gallery/lines/wiggle.py
- examples/gallery/lines/envelope.py
- examples/gallery/lines/line_custom_cpt.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: seisman <3974108+seisman@users.noreply.github.com>
…amples

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: seisman <3974108+seisman@users.noreply.github.com>
Replace list-based frame arguments with Frame and Axis class instances
from pygmt.params in six example files:

- examples/intro/01_first_figure.py: frame=["a", "+tMaine"] →
  Frame(title="Maine", axis=Axis(annot=True)); update prose comment
- examples/intro/03_figure_element.py: migrate WStr+tTitle with x/y axes
- examples/projections/nongeo/cartesian_linear.py: afg+gbisque → Frame
- examples/projections/nongeo/cartesian_logarithmic.py: WSne+gbisque → Frame
- examples/projections/nongeo/cartesian_power.py: WSne+gbisque → Frame
- examples/projections/nongeo/polar.py: all six panel frame settings → Frame

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: seisman <3974108+seisman@users.noreply.github.com>
Convert all list-based frame parameters in tutorial files to use the
Frame and Axis classes from pygmt.params, improving code readability
and type safety.

Files changed:
- examples/tutorials/basics/frames.py
- examples/tutorials/basics/text.py
- examples/tutorials/advanced/3d_perspective_image.py
- examples/tutorials/advanced/subplots.py
- examples/tutorials/advanced/non_ascii_text.py
- examples/tutorials/advanced/grid_equalization.py
- examples/tutorials/advanced/cartesian_histograms.py
- examples/tutorials/advanced/date_time_charts.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: seisman <3974108+seisman@users.noreply.github.com>
Replace legacy list-based frame specifications with Frame and Axis
class instances from pygmt.params across multiple source and test files:

- grdgradient_shading.py: Replace frame list with Frame(title=..., axis=Axis(...))
- helpers/testing.py: Update docstring example with Frame/Axis import and usage
- src/grdview.py: Update docstring example with Frame/Axis import and usage
- src/colorbar.py: Add Frame/Axis example to _build_frame docstring
- tests/test_basemap.py: Migrate loglog and power axis frame lists to Frame/Axis
- tests/test_config.py: Migrate simple af/xaf/yaf frame lists to Frame/Axis
- tests/test_geopandas.py: Migrate WsNeZ1/xag/yag/zag frame list to Frame/Axis
- tests/test_grdview.py: Migrate af/WSen and xaf/yaf/zaf frame lists to Frame/Axis

Complex time-axis patterns (pa1K, sa1K, sxa1D, pa1Hg, sa45mg45m etc.)
in test_config.py are left as lists to preserve their specific semantics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: seisman <3974108+seisman@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate frame settings to the new Frame/Axis syntax Migrate list-based frame settings to Frame/Axis syntax across examples and docs Apr 11, 2026
Copilot AI requested a review from seisman April 11, 2026 02:42
@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 Apr 11, 2026
@seisman seisman added this to the 0.19.0 milestone Apr 11, 2026
@seisman seisman marked this pull request as ready for review April 11, 2026 03:34
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 needs review This PR has higher priority and needs review. skip-changelog Skip adding Pull Request to changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate frame settings to the new Frame/Axis syntax across examples and docs

2 participants