Skip to content

DOC: Update the figure element intro to use the Axis/Frame classes - #4985

Open
seisman wants to merge 2 commits into
mainfrom
doc/intro03
Open

seisman wants to merge 2 commits into
mainfrom
doc/intro03

Conversation

@seisman

@seisman seisman commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

The "Figure elements" intro needs a redesign, but it definitely will take longer time.

This PR updates the existing script using the Axis/Frame classes.

Preview: https://pygmt-dev--4985.org.readthedocs.build/en/4985/intro/03_figure_element.html

@seisman seisman added this to the 0.20.0 milestone Nov 18, 2026
@seisman seisman added documentation Improvements or additions to documentation skip-changelog Skip adding Pull Request to changelog needs review This PR has higher priority and needs review. labels Nov 18, 2026
Comment thread examples/intro/03_figure_element.py Resolved
Comment thread examples/intro/03_figure_element.py Resolved
fig.text(x=8.4, y=22, text='Frame(title="Title")', **minorexplain)
# ============ xlabel
fig.text(x=5, y=-3, text='frame="x+lxlabel"', **minorexplain)
fig.text(x=5, y=-3.9, text='xaxis=Axis(label="xlabel")', **minorexplain)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe, strickly speaking it is:

Suggested change
fig.text(x=5, y=-3.9, text='xaxis=Axis(label="xlabel")', **minorexplain)
fig.text(x=5, y=-3.9, text='Frame(xaxis=Axis(label="xlabel"))', **minorexplain)

But this makes the labels longer and difficult to place without overlapping.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, it's a little too long. Maybe change it to a shorter version Axis(label="xlabel"), as this tutorial is mainly for showing the figure elements, rather than teaching how to use Axis/Frame

fig.text(x=5, y=-3.9, text='xaxis=Axis(label="xlabel")', **minorexplain)
# ============ ylabel
fig.text(x=-1.7, y=10, text='frame="y+lylabel"', angle=90, **minorexplain)
fig.text(x=-1.7, y=10, text='yaxis=Axis(label="ylabel")', angle=90, **minorexplain)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
fig.text(x=-1.7, y=10, text='yaxis=Axis(label="ylabel")', angle=90, **minorexplain)
fig.text(x=-1.7, y=10, text='Frame(yaxis=Axis(label="ylabel"))', angle=90, **minorexplain)

fig.plot(x=10, y=-0.2, style="c1c", pen="2p,darkblue", no_clip=True)
fig.text(x=10, y=-1.6, text="Annotation", **mainexplain)
fig.text(x=10, y=-2.8, text='frame="xa2"', **minorexplain)
fig.text(x=10, y=-2.8, text="xaxis=Axis(annot=2)", **minorexplain)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
fig.text(x=10, y=-2.8, text="xaxis=Axis(annot=2)", **minorexplain)
fig.text(x=10, y=-2.8, text="Frame(xaxis=Axis(annot=2))", **minorexplain)

fig.plot(x=-0.2, y=20, style="c1c", pen="2p,darkblue", no_clip=True)
fig.text(x=0, y=23.4, text="Annotation", **mainexplain)
fig.text(x=0, y=22.2, text='frame="ya5"', **minorexplain)
fig.text(x=0, y=22.2, text="yaxis=Axis(annot=5)", **minorexplain)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
fig.text(x=0, y=22.2, text="yaxis=Axis(annot=5)", **minorexplain)
fig.text(x=0, y=22.2, text="Frame(yaxis=Axis(annot=5))", **minorexplain)

fig.plot(x=1, y=-0.2, style="c0.7c", pen="2p,darkblue", no_clip=True)
fig.text(x=1, y=-1.4, text="Frame", **mainexplain)
fig.text(x=1, y=-2.6, text='frame="xf1"', **minorexplain)
fig.text(x=1, y=-2.6, text="xaxis=Axis(tick=1)", **minorexplain)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
fig.text(x=1, y=-2.6, text="xaxis=Axis(tick=1)", **minorexplain)
fig.text(x=1, y=-2.6, text="Frame(xaxis=Axis(tick=1))", **minorexplain)

# ============ y-minorticks
fig.plot(x=0, y=2, style="c0.7c", pen="2p,darkblue", no_clip=True)
fig.text(x=-1.5, y=1, text='frame="yf1"', **minorexplain)
fig.text(x=-2.6, y=2.3, text="yaxis=Axis(tick=1)", **minorexplain)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
fig.text(x=-2.6, y=2.3, text="yaxis=Axis(tick=1)", **minorexplain)
fig.text(x=-2.6, y=2.3, text="Frame(yaxis=Axis(tick=1))", **minorexplain)

Comment on lines +74 to +75
fig.text(x=2.4, y=19, text="xaxis=Axis(grid=2)", **minorexplain)
fig.text(x=2.4, y=18, text="yaxis=Axis(grid=5)", **minorexplain)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
fig.text(x=2.4, y=19, text="xaxis=Axis(grid=2)", **minorexplain)
fig.text(x=2.4, y=18, text="yaxis=Axis(grid=5)", **minorexplain)
fig.text(x=2.4, y=19, text="Frame(xaxis=Axis(grid=2))", **minorexplain)
fig.text(x=2.4, y=18, text="Frame(yaxis=Axis(grid=5))", **minorexplain)

Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>

This branch has not been deployed

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

Labels

documentation Improvements or additions to documentation 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.

2 participants