GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Figure.text: Allow passing a sequence of offset to the 'offset' parameter by seisman · Pull Request #4652 · GenericMappingTools/pygmt

Conversation

@seisman

@seisman seisman commented May 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Passing a sequence of offsets to Figure.text is frequently used but not supported yet.

This PR supports it and also migrates offset to the new alias system.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

yvonnefroehlich reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@seisman
Figure.text: Allow passing a sequence of offset to the 'offset' param…
991257a
…eter
@seisman seisman added this to the 0.19.0 milestone May 22, 2026
@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. labels May 22, 2026
seisman
seisman commented May 22, 2026
View reviewed changes
Comment thread examples/gallery/images/cross_section.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

seisman added 2 commits May 23, 2026 00:13
@seisman
Fix a typo
6ec96f1
@seisman
Merge branch 'main' into text/offset
b921ca8
@seisman
seisman requested a review from a team May 25, 2026 15:17
@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 May 25, 2026
weiji14
weiji14 reviewed May 27, 2026
View reviewed changes
Comment thread examples/gallery/images/cross_section.py
y=[latA, latB],
text=["A", "B"],
offset="0c/0.3c", # Move text 0.2 centimeters up (y-direction)
offset=(0, 0.3), # Move text 0.3 centimeters up (y-direction)

@weiji14 weiji14 May 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Should we keep the "c" unit specifier? The gmt.conf docs say:

It is recommended that users specify the units for distances and lengths by appending c (cm), i (inch), or p (points) when changing parameters using any of these methods. By default, when no unit is specified the value will be assumed to be cm for parameters not related to fonts or pen thicknesses and will be assumed to be points for parameters related to fonts or pen thicknesses.

So recommended is to append the unit, but no unit means centimeter in some but not all cases (I guess offset counts as non-font/pen thickness?). Maybe keep it as ("0c", "0.3c") to be clearer?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@seisman seisman May 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yes, appending the unit specifier is recommended in the GMT CLI. However, in PyGMT, I feel it is more natural to use plain numbers for quantities such as offsets, widths, and sizes. They are much shorter to type and can also be used directly in calculations.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seisman
Merge branch 'main' into text/offset
29e4557
@seisman
seisman requested a review from Copilot June 4, 2026 04:50
Copilot started reviewing on behalf of seisman June 4, 2026 04:50
View session
Copilot AI reviewed Jun 4, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 updates pygmt.Figure.text to accept tuple/sequence forms for the offset parameter and migrates offset handling to PyGMT’s newer AliasSystem, with corresponding documentation and example updates.

Changes:

  • Add offset to Figure.text’s signature and handle it via AliasSystem (-D option) with sep="/" and size=2.
  • Update the text docstring to document tuple-style offsets.
  • Update gallery/tutorial examples to use numeric/tuple offsets instead of unit-suffixed strings.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pygmt/src/text.py Adds offset parameter + AliasSystem wiring for -D, and updates documentation for tuple offsets.
examples/tutorials/basics/text.py Switches fig.text(..., offset=...) examples from strings (e.g., "1c/-0.5c") to tuples.
examples/gallery/symbols/points_cities.py Updates offset example usage from "0.12c" to 0.12.
examples/gallery/lines/vector_heads_tails.py Updates offset example usage from string to tuple.
examples/gallery/lines/quoted_lines.py Updates offset example usage from string to tuple.
examples/gallery/lines/linestyles.py Updates offset example usage from strings to tuples.
examples/gallery/lines/linefronts.py Updates offset example usage from string to tuple.
examples/gallery/lines/decorated_lines.py Updates offset example usage from string to tuple.
examples/gallery/images/cross_section.py Updates offset example usage from string to tuple and adjusts the comment accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pygmt/src/text.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/src/text.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/src/text.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

seisman added 2 commits June 5, 2026 10:08
@seisman
Merge branch 'main' into text/offset
dbf0331
@seisman
Merge branch 'main' into text/offset
6847c8c
@seisman
seisman merged commit b5fe0d4 into main Jun 5, 2026
22 of 23 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@seisman
seisman deleted the text/offset branch June 5, 2026 17:48
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Jun 5, 2026
@seisman seisman mentioned this pull request Jun 5, 2026
Figs1&6: Update Figure.text's offset parameter to the new syntax and bump to pygmt v0.19.0dev229 GenericMappingTools/pygmt-paper-figures#66
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@weiji14 weiji14 weiji14 left review comments
Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement Improving an existing feature

Projects

None yet

Milestone

0.19.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@seisman @weiji14
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.