Skip to content

Figure.subplot: Expand the documentation of figsize and subsize - #4964

Open
hifarrer wants to merge 1 commit into
GenericMappingTools:mainfrom
hifarrer:expand-subplot-figsize-subsize-docs
Open

hifarrer wants to merge 1 commit into
GenericMappingTools:mainfrom
hifarrer:expand-subplot-figsize-subsize-docs

Conversation

@hifarrer

Copy link
Copy Markdown

Description of proposed changes

The docstrings of the figsize and subsize parameters of Figure.subplot were only one-liners. This PR expands them, following the current GMT subplot documentation (the text suggested in the issue is from GMT 6.2). They now describe:

  • how the figure and subplot dimensions are derived from each other,
  • how to set different widths/heights per column/row (+f fractions for figsize, comma-separated lists for subsize),
  • how the subplot height is computed from region and projection for geographic maps (this only works with subsize, as in GMT),
  • the modifiers +a, +c, +g, +p and +w.

I also changed the type lines from list to tuple or str, because strings are needed for the modifiers and lists, and the docstring example already uses a tuple. Happy to revert that if you prefer.

Only the docstring changes, no code.

How it was checked: I don't have GMT installed (Windows), so nothing was run against a real GMT. With Claude Code I checked that ruff, the pre-commit hooks, codespell and typos pass. I also checked that the docstring renders without docutils or Sphinx napoleon warnings. With the GMT session stubbed out, PyGMT builds the expected command lines (e.g. -Ff10c/10c+f3,1/1,2 and -Fs5c,8c/8c). I compared the statements with the GMT docs and with GMT's subplot.c. The docs CI build will be the first full build.

This change was prepared with Claude Code (Claude Sonnet 5.5).

Fixes #1370

Preview:

Guidelines

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

Describe how the figure and subplot dimensions are derived from each
other, how to set different widths/heights per column/row (+f fractions
for figsize, comma-separated lists for subsize), how the subplot height
is computed from region and projection for geographic maps, and the
+a, +c, +g, +p and +w modifiers. The wording follows the current GMT
subplot documentation.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expand pygmt subplot's documentation for the figsize and subsize parameters

1 participant