Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Dec 20, 2025

This PR provides a more Pythonic implementation for the -A option of subplot by splitting it into multiple parameters.

The full syntax is:

-A[autotag][+cdx[/dy]][+gfill][+j|Jrefpoint][+odx[/dy]][+ppen][+r|R][+s[[dx/dy][/shade]]][+v]

In PyGMT, the Pythonic parameters are:

  • autotag: autotag [Previously it's called autolabel, but I feel it should be called autotag or tag]
  • [+cdx[/dy]][+gfill][+ppen][+s[[dx/dy][/shade]]]: tag_box. Controls the box outline. It's a subset of the existing Box class, so we can directly pass a Box object!
  • [+j|Jrefpoint][+odx[/dy]]: tag_position/tag_offset. Currently only +j is supported, but since it's very similar to the Position class, maybe we can make it accept a Position class?
  • +r|R: tag_number_style
  • +v: tag_orientation
  • FONT_TAG: tag_font

It's a POC PR, and is not complete or final yet. Here is an example usage:

import pygmt
from pygmt.params import Box

fig = pygmt.Figure()
with fig.subplot(
    nrows=2, ncols=2, subsize=(5, 5), 
    autotag="(1)", 
    tag_box=Box(pen="1p,red", fill="lightblue"), 
    tag_position="TL", 
    tag_offset=(0.2, 0.2), 
    tag_orientation="vertical",
    tag_number_style="roman_upper",
    tag_font="12p,blue"
):
    for i in range(4):
        fig.basemap(region=[0, 10, 0, 10], projection="X?", panel=True)
fig.show()

@seisman seisman added the enhancement Improving an existing feature label Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants