Skip to content

Figure.pygmtlogo: Improved positioning of vertical wordmark for circular PyGMT logo#4637

Open
seisman wants to merge 2 commits into
pygmtlogo-fontfrom
pygmtlogo-wordmark-vertical
Open

Figure.pygmtlogo: Improved positioning of vertical wordmark for circular PyGMT logo#4637
seisman wants to merge 2 commits into
pygmtlogo-fontfrom
pygmtlogo-wordmark-vertical

Conversation

@seisman
Copy link
Copy Markdown
Member

@seisman seisman commented May 13, 2026

This is a follow-up PR to #4627. See PR #4627 for additional context.

The script demonstrates two different approaches for centering the wordmark beneath the visual logo. Version 1 is simpler, but the centering is only approximate. Version 2 uses the font metrics to achieve exact centering.

import pygmt
from pygmt.params import Position

pheight = 0.739  # Height of "P"
plsb = 0.076 # Left side bearing of "P"
pstroke = 0.0735  # Stroke thickness of "P"
ydesc = 0.192  # Descender depth of "y"
pygmtwidth = 3.262   # Full width of "PyGMT"

fontsize = 8 / pygmtwidth
# fontsize = 2.2
# Version 1: Center using "TC"
x0, y0, justify = 0, -4.5, "TC"
# Version 2: Accurate centering
x0, y0, justify = -4 - fontsize * plsb, -4.5, "TL"

fig = pygmt.Figure()
fig.basemap(region=[-4, 4, -7, 4], projection="x1c", frame="ag1")
fig.pygmtlogo(width="8c", position=Position((0, 0), cstype="mapcoords", anchor="MC"))
fig.text(x=x0, y=y0, justify=justify, text="PyGMT", font=f"{fontsize}c,AvantGarde-Book", no_clip=True)
fig.hlines(y=-4.5, pen="1p,gray,-")
fig.show()
fig.savefig("logo-wordmark.png")
Version 1 Version 2
logo-wordmark logo-wordmark

Additional notes for Version 2:

  • The top of the letter G aligns at y=-4.5, rather than the tops of the letters PMT

  • Alternatively, it would also be possible to:

    • align the tops of the letters PMT at y=-4.5, or
    • vertically center the letters PMT at y=-5.5

We may also want to ensure it also works well with hexagon shape, but it's always easier to decide an initial version for circular logo first, then revise it later when working on hexagon logos.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

Summary of changed images

This is an auto-generated report of images that have changed on the DVC remote

Status Path
modified pygmt/tests/baseline/test_pygmtlogo_circle_design_vertical.png

Image diff(s)

Details

Added images

Modified images

Path Old New
test_pygmtlogo_circle_design_vertical.png

Report last updated at commit 834ea25

@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. labels May 13, 2026
@seisman seisman added this to the 0.19.0 milestone May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving an existing feature needs review This PR has higher priority and needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant