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.inset: Deprecate parameter margin to clearance (Will be removed in v0.20.0) by yvonnefroehlich · Pull Request #4296 · GenericMappingTools/pygmt

Conversation

@yvonnefroehlich

@yvonnefroehlich yvonnefroehlich commented Dec 17, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Description of proposed changes

To make the parameter name consistent with Figure.suplot and to consider that a list can be passed with different margins for the different sides.
Note: Since GMT 6.4.0 -M is changed to -C (see #4296 (comment)), so it should be not margins but clearance (see #4296 (comment)).

Preview:

Guidelines

  • General Guidelines for Pull Request
  • Guidelines for Contributing Documentation
  • Guidelines for Contributing Code

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

Sorry, something went wrong.

Uh oh!

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

All reactions
yvonnefroehlich added 3 commits December 17, 2025 05:53
@yvonnefroehlich
Deprecate margin to margins
55a1b07
@yvonnefroehlich
Update gallery examples
737b3a5
@yvonnefroehlich
Update test
db0306b
@yvonnefroehlich yvonnefroehlich added this to the 0.18.0 milestone Dec 17, 2025
@yvonnefroehlich yvonnefroehlich self-assigned this Dec 17, 2025
@yvonnefroehlich yvonnefroehlich added the deprecation Deprecating a feature label Dec 17, 2025
@yvonnefroehlich yvonnefroehlich mentioned this pull request Dec 17, 2025
Naming conventions for parameter names #2014
Closed
seisman
seisman reviewed Dec 17, 2025
View reviewed changes
Comment thread pygmt/src/inset.py Resolved

Uh oh!

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

seisman
seisman reviewed Dec 17, 2025
View reviewed changes
Comment thread pygmt/src/inset.py Resolved

Uh oh!

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

yvonnefroehlich and others added 2 commits December 17, 2025 06:18
@yvonnefroehlich @seisman
Update GMT flag
3b1c193
Co-authored-by: Dongdong Tian <[email protected]>
@yvonnefroehlich
Update inline example
6e7d973
@seisman

seisman commented Dec 17, 2025

Copy link
Copy Markdown
Member

It's a good time to decide the implemention of the margins parameter. The GMT documentation says:

Reserve a space of dimension clearance between the actual inset plot area and the given inset box on the specified side, using side values from w, e, s, or n, or x for both w and e or y for both s and n. No side means all sides. The option is repeatable to set aside space on more than one side. Alternatively, if all sides are to be set you can also give a pair of values separated by slashes (for setting separate horizontal and vertical margins), or the full set of four separate margins. Such space will be left untouched by the inset map plotting. Append units as desired [Default is set by PROJ_LENGTH_UNIT].

So, the GMT CLI usage can be:

  • -C1: for all sides
  • -C1/2: for x and y sides, respectively
  • -C1/2/3/4: for w, e, s, and n sides, respectively

Or, it's possible to set margins with repeated options, e.g.,

  • -Cx1
  • -Cx1 -Cy2
  • -Cw1 -Cs3
  • -Cw1 -Ce2 -Cs3 -Cn4

I feel it's technically possible but difficult to support both. To keep it simple, I would prefer to only support the first usage, i.e.,:

  • margins=1
  • margins=(1, 2)
  • margins=(1, 2, 3, 4)

To set margins for specific sides only, users can set it to 0. For example,

  • -Cx1 is equivalent to margins=(1, 0)
  • -Cw1 -Cs3 is equivalent to margins=(1, 0, 3, 0)
All reactions

Sorry, something went wrong.

Uh oh!

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

@seisman

seisman commented Dec 17, 2025

Copy link
Copy Markdown
Member

Actually, it should be clearance instead.

In subplot, -C is aliased to clearance and -M is aliased to margins.

yvonnefroehlich reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

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

@yvonnefroehlich
Deprecate margin to clearance as for GMT M was changed to C
77fadde
@yvonnefroehlich yvonnefroehlich changed the title Figure.inset: Deprecate parameter margin to margins (Will be removed in v0.20.0) Figure.inset: Deprecate parameter margin to clearanc (Will be removed in v0.20.0) Dec 17, 2025
@yvonnefroehlich yvonnefroehlich changed the title Figure.inset: Deprecate parameter margin to clearanc (Will be removed in v0.20.0) Figure.inset: Deprecate parameter margin to clearance (Will be removed in v0.20.0) Dec 17, 2025
@yvonnefroehlich

yvonnefroehlich commented Dec 17, 2025

Copy link
Copy Markdown
Member Author

Actually, it should be clearance instead.

In subplot, -C is aliased to clearance and -M is aliased to margins.

With the change from -M to -C we should also change the parameter name in PyGMT to have this consistent. Updatde to clearance in commit 77fadde.

All reactions

Sorry, something went wrong.

Uh oh!

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

@yvonnefroehlich
Merge branch 'main' into deprecate-inset-margin
3c5bfdc
seisman
seisman approved these changes Dec 18, 2025
View reviewed changes
@seisman

seisman commented Dec 18, 2025

Copy link
Copy Markdown
Member

I feel this PR is good to merge. We can update the docstrings of Figure.inset and Figure.subplot in a separate PR.

All reactions

Sorry, something went wrong.

Uh oh!

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

@seisman
seisman merged commit 626a734 into main Dec 18, 2025
@seisman
seisman deleted the deprecate-inset-margin branch December 18, 2025 08:39
This was referenced Dec 18, 2025
Figure.inset: Fix a typo and improve existing tests #4304
Merged
Figure 4: Update margin to clearance in Figure.inset and update Figure.legend syntax GenericMappingTools/pygmt-paper-figures#21
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@seisman seisman seisman approved these changes

Uh oh!

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

Assignees

@yvonnefroehlich yvonnefroehlich

Labels

deprecation Deprecating a feature

Projects

None yet

Milestone

0.18.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

2 participants

@yvonnefroehlich @seisman
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 01402792 — 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.