From 25ac0284e2613ecfd9afbbf89e3df2e7b7069539 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 13 May 2026 17:11:44 +0800 Subject: [PATCH 1/5] Figure.pygmtlogo: Improved positioning of vertical wordmark for circular PyGMT logo --- pygmt/src/pygmtlogo.py | 13 ++++++++++++- .../test_pygmtlogo_circle_design_vertical.png.dvc | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pygmt/src/pygmtlogo.py b/pygmt/src/pygmtlogo.py index e8cfc7fa643..cf3c2430bfa 100644 --- a/pygmt/src/pygmtlogo.py +++ b/pygmt/src/pygmtlogo.py @@ -85,10 +85,19 @@ def _create_logo( # noqa: PLR0915 pheight = 0.739 # Height of letter "P" plsb = 0.076 # Left side bearing of letter "P" pstroke = 0.0735 # Stroke thickness of letter "P" + pygmtwidth = 3.262 # Full width of "PyGMT" match wordmark: case "vertical": - args_wordmark = {"x": 0, "y": -4.5, "justify": "CT", "font": f"2.4c,{font}"} + # Ensure the same width for the visual logo and wordmark + fontsize = size * 2.0 / pygmtwidth + args_wordmark = { + "x": -size - fontsize * plsb, + "y": -size * 1.125, + "justify": "TL", + "font": f"{fontsize}c,{font}", + "no_clip": True, # Needed because x0 Date: Wed, 13 May 2026 17:29:03 +0800 Subject: [PATCH 2/5] Fix a typo --- pygmt/src/pygmtlogo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/pygmtlogo.py b/pygmt/src/pygmtlogo.py index cf3c2430bfa..c21b6cce33d 100644 --- a/pygmt/src/pygmtlogo.py +++ b/pygmt/src/pygmtlogo.py @@ -96,7 +96,7 @@ def _create_logo( # noqa: PLR0915 "y": -size * 1.125, "justify": "TL", "font": f"{fontsize}c,{font}", - "no_clip": True, # Needed because x0 Date: Thu, 14 May 2026 10:08:43 +0800 Subject: [PATCH 3/5] Add a test and baseline images --- ...pygmtlogo_circle_vertical_wordmark.png.dvc | 5 ++++ pygmt/tests/test_pygmtlogo.py | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 pygmt/tests/baseline/test_pygmtlogo_circle_vertical_wordmark.png.dvc diff --git a/pygmt/tests/baseline/test_pygmtlogo_circle_vertical_wordmark.png.dvc b/pygmt/tests/baseline/test_pygmtlogo_circle_vertical_wordmark.png.dvc new file mode 100644 index 00000000000..d31ff32de85 --- /dev/null +++ b/pygmt/tests/baseline/test_pygmtlogo_circle_vertical_wordmark.png.dvc @@ -0,0 +1,5 @@ +outs: +- md5: 666643ce5d01dafd5d1831a511c12812 + size: 40928 + hash: md5 + path: test_pygmtlogo_circle_vertical_wordmark.png diff --git a/pygmt/tests/test_pygmtlogo.py b/pygmt/tests/test_pygmtlogo.py index 26cd9b10947..3cd8fb5201d 100644 --- a/pygmt/tests/test_pygmtlogo.py +++ b/pygmt/tests/test_pygmtlogo.py @@ -73,3 +73,30 @@ def test_pygmtlogo_circle_horizontal_wordmark(): wordmark="horizontal", ) return fig + + +@pytest.mark.mpl_image_compare +def test_pygmtlogo_circle_vertical_wordmark(): + """ + Test the PyGMT circular logo with a vertical wordmark, including both light/dark + themes, and colored/black-and-white versions. + """ + fig = Figure() + fig.basemap( + region=[-0.5, 5.0, -0.5, 5.5], + projection="x1c", + frame=Frame(fill="gray", axis=Axis(grid=0.5)), + ) + for (x, y), theme, color in [ + ((1.0, 4.0), "light", True), + ((3.5, 4.0), "dark", True), + ((1.0, 1.0), "light", False), + ((3.5, 1.0), "dark", False), + ]: + fig.pygmtlogo( + position=Position((x, y), anchor="CM", cstype="mapcoords"), + theme=theme, + color=color, + wordmark="vertical", + ) + return fig From d47cda6d19a21d00a03d9bb03fa3655d7c1cc94b Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 14 May 2026 19:30:36 +0800 Subject: [PATCH 4/5] Update tests and baseline images --- ...vc => test_pygmtlogo_wordmark_vertical_circle.png.dvc} | 2 +- pygmt/tests/test_pygmtlogo.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) rename pygmt/tests/baseline/{test_pygmtlogo_circle_vertical_wordmark.png.dvc => test_pygmtlogo_wordmark_vertical_circle.png.dvc} (58%) diff --git a/pygmt/tests/baseline/test_pygmtlogo_circle_vertical_wordmark.png.dvc b/pygmt/tests/baseline/test_pygmtlogo_wordmark_vertical_circle.png.dvc similarity index 58% rename from pygmt/tests/baseline/test_pygmtlogo_circle_vertical_wordmark.png.dvc rename to pygmt/tests/baseline/test_pygmtlogo_wordmark_vertical_circle.png.dvc index d31ff32de85..00beef76f5a 100644 --- a/pygmt/tests/baseline/test_pygmtlogo_circle_vertical_wordmark.png.dvc +++ b/pygmt/tests/baseline/test_pygmtlogo_wordmark_vertical_circle.png.dvc @@ -2,4 +2,4 @@ outs: - md5: 666643ce5d01dafd5d1831a511c12812 size: 40928 hash: md5 - path: test_pygmtlogo_circle_vertical_wordmark.png + path: test_pygmtlogo_wordmark_vertical_circle.png diff --git a/pygmt/tests/test_pygmtlogo.py b/pygmt/tests/test_pygmtlogo.py index f5d8fbfb2a8..5346e1d1b15 100644 --- a/pygmt/tests/test_pygmtlogo.py +++ b/pygmt/tests/test_pygmtlogo.py @@ -81,10 +81,11 @@ def test_pygmtlogo_wordmark_horizontal(shape): @pytest.mark.mpl_image_compare -def test_pygmtlogo_circle_vertical_wordmark(): +@pytest.mark.parametrize("shape", ["circle"]) +def test_pygmtlogo_wordmark_vertical(shape): """ - Test the PyGMT circular logo with a vertical wordmark, including both light/dark - themes, and colored/black-and-white versions. + Test the PyGMT logo with a vertical wordmark, including both light/dark themes, + and colored/black-and-white versions. """ fig = Figure() fig.basemap( @@ -102,6 +103,7 @@ def test_pygmtlogo_circle_vertical_wordmark(): position=Position((x, y), anchor="CM", cstype="mapcoords"), theme=theme, color=color, + shape=shape, wordmark="vertical", ) return fig From 166f2efce5bd125d4dbd5c6d08db9c099fc4ef7b Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 14 May 2026 19:32:31 +0800 Subject: [PATCH 5/5] Update baseline image for logo design --- .../baseline/test_pygmtlogo_design_circle-vertical.png.dvc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/tests/baseline/test_pygmtlogo_design_circle-vertical.png.dvc b/pygmt/tests/baseline/test_pygmtlogo_design_circle-vertical.png.dvc index ec88138185f..a2925589bae 100644 --- a/pygmt/tests/baseline/test_pygmtlogo_design_circle-vertical.png.dvc +++ b/pygmt/tests/baseline/test_pygmtlogo_design_circle-vertical.png.dvc @@ -1,5 +1,5 @@ outs: -- md5: 5ee82660f20bc8424f3051af4f9fb9ac - size: 173671 +- md5: affb1d00551312eaaf132e8566dd446b + size: 174450 hash: md5 path: test_pygmtlogo_design_circle-vertical.png