Skip to content

Add the Frame/Axis class for setting frame and axes [Part 1]#4406

Open
seisman wants to merge 18 commits intomainfrom
class/frame-part1
Open

Add the Frame/Axis class for setting frame and axes [Part 1]#4406
seisman wants to merge 18 commits intomainfrom
class/frame-part1

Conversation

@seisman
Copy link
Member

@seisman seisman commented Feb 10, 2026

This PR implements the Frame/Axis class for setting frame and axes attributes. It's a subset of PR #4016 because the -B option is complicated, and it will take a long time to finish #4016, which again will delay the paper submission.

Currently, only a small subset of the -B option is implemented in this PR, but it should already cover most use cases.

Here is a comparison table between the GMT CLI and the PyGMT versions:

GMT PyGMT
-B frame=True
-BWSEN frame=Frame("WSEN") or frame=Frame(axes="WSEN")
-BWSEN+tMY TITLE frame=Frame("WSEN", title="MY TITLE")
-Ba frame=Axis(annnot=True)
-Bafg frame=Axis(annot=True, tick=True, grid=True)
-Ba30f15g5 frame=Axis(annot=30, tick=15, grid=5)
-Ba30f15g5+lLABEL frame=Axis(annot=30, tick=15, grid=5, label="LABEL")
-BWSEN+tTITLE -Bxa30f15g5+lXlabel -Bya4f2g1+lYlabel frame=Frame("WSEN", title="TITLE", xaxis=Axis(annot=30, tick=15, grid=5, label="Ylabel"), yaxis=Axis(annot=4, tick=4, grid=1, label="Ylabel"))

This PR doens't break backward-compatibility, so frame="WSEN", frame="afg", frame="a30f15g5", frame=["WSEN+tTITLE", "xafg", "yafg"] are still supported.

Preview:

@seisman seisman added enhancement Improving an existing feature feature Brand new feature and removed enhancement Improving an existing feature labels Feb 10, 2026
@seisman seisman added this to the 0.19.0 milestone Feb 10, 2026
@seisman seisman added the needs review This PR has higher priority and needs review. label Feb 10, 2026
@seisman seisman requested a review from a team February 25, 2026 05:06
@seisman seisman removed the needs review This PR has higher priority and needs review. label Mar 6, 2026
@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Mar 6, 2026
>>> fig.basemap(
... region=[0, 10, 0, 20],
... projection="X10c/10c",
... frame=Axis(annot=4, tick=2, grid=1),
Copy link
Member

Choose a reason for hiding this comment

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

The "long" version would be
frame=Frame(axis=Axis(annot=4, tick=2, grid=1))
?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

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

Labels

feature Brand new feature final review call This PR requires final review and approval from a second reviewer high-priority

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants