From 07bfe565a3fd40a93479ac13df58ab75170a27a4 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sat, 9 May 2026 19:36:16 +0800 Subject: [PATCH 1/4] Figure.pygmtlogo: Implement the hexagonal logo --- pygmt/src/pygmtlogo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pygmt/src/pygmtlogo.py b/pygmt/src/pygmtlogo.py index ec1bb7d9250..a161075f5cf 100644 --- a/pygmt/src/pygmtlogo.py +++ b/pygmt/src/pygmtlogo.py @@ -166,7 +166,8 @@ def _bg_arrow_coords(): def _compass_lines(): """Coordinates of compass lines.""" - angle = np.deg2rad(45.0) # Angle of diagonal compass lines + # Angle of diagonal compass lines + angle = np.deg2rad({"circle": 45.0, "hexagon": 30.0}[shape]) sinx, cosx = np.sin(angle), np.cos(angle) x1, x2, x3 = r0 * sinx, r3 * sinx, (r2 + (r3 - r4)) * sinx From 3d92d329e9deeb74e831e27d30298c86261bea13 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 14 May 2026 10:54:13 +0800 Subject: [PATCH 2/4] Fix the size of the hexagon outline --- 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 986e101aca9..47b029fc87c 100644 --- a/pygmt/src/pygmtlogo.py +++ b/pygmt/src/pygmtlogo.py @@ -75,7 +75,7 @@ def _create_logo( # noqa: PLR0915 hex_factor = 1.0 case "hexagon": symbol = "h" - size_shape = (r0 + 0.34) * 2 + size_shape = (r0 + r1) / np.cos(np.deg2rad(30)) hex_factor = 1.1 # Define wordmark From e1d162b5d22ee18c8b8fec0031d56d56dafa0261 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 14 May 2026 11:53:40 +0800 Subject: [PATCH 3/4] Revert "Figure.pygmtlogo: Implement the hexagonal logo" This reverts commit 07bfe565a3fd40a93479ac13df58ab75170a27a4. --- pygmt/src/pygmtlogo.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pygmt/src/pygmtlogo.py b/pygmt/src/pygmtlogo.py index 47b029fc87c..173fe31300d 100644 --- a/pygmt/src/pygmtlogo.py +++ b/pygmt/src/pygmtlogo.py @@ -166,8 +166,7 @@ def _bg_arrow_coords(): def _compass_lines(): """Coordinates of compass lines.""" - # Angle of diagonal compass lines - angle = np.deg2rad({"circle": 45.0, "hexagon": 30.0}[shape]) + angle = np.deg2rad(45.0) # Angle of diagonal compass lines sinx, cosx = np.sin(angle), np.cos(angle) x1, x2, x3 = r0 * sinx, r3 * sinx, (r2 + (r3 - r4)) * sinx From 2f12fc5eb791b1d8192d69a1c44d5232f38375f6 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 14 May 2026 20:20:35 +0800 Subject: [PATCH 4/4] Add baseline images for hexagonal logo --- .../test_pygmtlogo_design_hexagon-horizontal.png.dvc | 5 +++++ .../test_pygmtlogo_design_hexagon-vertical.png.dvc | 5 +++++ .../test_pygmtlogo_wordmark_horizontal_hexagon.png.dvc | 5 +++++ .../baseline/test_pygmtlogo_wordmark_none_hexagon.png.dvc | 5 +++++ .../test_pygmtlogo_wordmark_vertical_hexagon.png.dvc | 5 +++++ pygmt/tests/test_pygmtlogo.py | 8 ++++---- 6 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 pygmt/tests/baseline/test_pygmtlogo_design_hexagon-horizontal.png.dvc create mode 100644 pygmt/tests/baseline/test_pygmtlogo_design_hexagon-vertical.png.dvc create mode 100644 pygmt/tests/baseline/test_pygmtlogo_wordmark_horizontal_hexagon.png.dvc create mode 100644 pygmt/tests/baseline/test_pygmtlogo_wordmark_none_hexagon.png.dvc create mode 100644 pygmt/tests/baseline/test_pygmtlogo_wordmark_vertical_hexagon.png.dvc diff --git a/pygmt/tests/baseline/test_pygmtlogo_design_hexagon-horizontal.png.dvc b/pygmt/tests/baseline/test_pygmtlogo_design_hexagon-horizontal.png.dvc new file mode 100644 index 00000000000..ea880e8ee7b --- /dev/null +++ b/pygmt/tests/baseline/test_pygmtlogo_design_hexagon-horizontal.png.dvc @@ -0,0 +1,5 @@ +outs: +- md5: 1ab652c5ba076ee29a0c1c1c336bf281 + size: 357515 + hash: md5 + path: test_pygmtlogo_design_hexagon-horizontal.png diff --git a/pygmt/tests/baseline/test_pygmtlogo_design_hexagon-vertical.png.dvc b/pygmt/tests/baseline/test_pygmtlogo_design_hexagon-vertical.png.dvc new file mode 100644 index 00000000000..84e2e798a21 --- /dev/null +++ b/pygmt/tests/baseline/test_pygmtlogo_design_hexagon-vertical.png.dvc @@ -0,0 +1,5 @@ +outs: +- md5: 7c63ae282d62472c4420a1dd482fce97 + size: 195380 + hash: md5 + path: test_pygmtlogo_design_hexagon-vertical.png diff --git a/pygmt/tests/baseline/test_pygmtlogo_wordmark_horizontal_hexagon.png.dvc b/pygmt/tests/baseline/test_pygmtlogo_wordmark_horizontal_hexagon.png.dvc new file mode 100644 index 00000000000..a0c344b992e --- /dev/null +++ b/pygmt/tests/baseline/test_pygmtlogo_wordmark_horizontal_hexagon.png.dvc @@ -0,0 +1,5 @@ +outs: +- md5: a2af1063edc39f78976bce5a6ff76bef + size: 55897 + hash: md5 + path: test_pygmtlogo_wordmark_horizontal_hexagon.png diff --git a/pygmt/tests/baseline/test_pygmtlogo_wordmark_none_hexagon.png.dvc b/pygmt/tests/baseline/test_pygmtlogo_wordmark_none_hexagon.png.dvc new file mode 100644 index 00000000000..8f4a83f7d14 --- /dev/null +++ b/pygmt/tests/baseline/test_pygmtlogo_wordmark_none_hexagon.png.dvc @@ -0,0 +1,5 @@ +outs: +- md5: f821a40456a61abe7859685cc90080a9 + size: 28794 + hash: md5 + path: test_pygmtlogo_wordmark_none_hexagon.png diff --git a/pygmt/tests/baseline/test_pygmtlogo_wordmark_vertical_hexagon.png.dvc b/pygmt/tests/baseline/test_pygmtlogo_wordmark_vertical_hexagon.png.dvc new file mode 100644 index 00000000000..1e6689fa923 --- /dev/null +++ b/pygmt/tests/baseline/test_pygmtlogo_wordmark_vertical_hexagon.png.dvc @@ -0,0 +1,5 @@ +outs: +- md5: 7b7919375c9dbc354c8ef5f86a33e830 + size: 37203 + hash: md5 + path: test_pygmtlogo_wordmark_vertical_hexagon.png diff --git a/pygmt/tests/test_pygmtlogo.py b/pygmt/tests/test_pygmtlogo.py index 5346e1d1b15..feaf9c1a3d4 100644 --- a/pygmt/tests/test_pygmtlogo.py +++ b/pygmt/tests/test_pygmtlogo.py @@ -10,7 +10,7 @@ @pytest.mark.mpl_image_compare(savefig_kwargs={"dpi": 600}) @pytest.mark.parametrize("wordmark", ["horizontal", "vertical"]) -@pytest.mark.parametrize("shape", ["circle"]) +@pytest.mark.parametrize("shape", ["circle", "hexagon"]) def test_pygmtlogo_design(shape, wordmark): """ Test the design details of the PyGMT logo with a wordmark. @@ -24,7 +24,7 @@ def test_pygmtlogo_design(shape, wordmark): @pytest.mark.mpl_image_compare -@pytest.mark.parametrize("shape", ["circle"]) +@pytest.mark.parametrize("shape", ["circle", "hexagon"]) def test_pygmtlogo_wordmark_none(shape): """ Test the PyGMT logo without the wordmark, including both light/dark themes, and @@ -52,7 +52,7 @@ def test_pygmtlogo_wordmark_none(shape): @pytest.mark.mpl_image_compare -@pytest.mark.parametrize("shape", ["circle"]) +@pytest.mark.parametrize("shape", ["circle", "hexagon"]) def test_pygmtlogo_wordmark_horizontal(shape): """ Test the PyGMT logo with a horizontal wordmark, including both light/dark themes, @@ -81,7 +81,7 @@ def test_pygmtlogo_wordmark_horizontal(shape): @pytest.mark.mpl_image_compare -@pytest.mark.parametrize("shape", ["circle"]) +@pytest.mark.parametrize("shape", ["circle", "hexagon"]) def test_pygmtlogo_wordmark_vertical(shape): """ Test the PyGMT logo with a vertical wordmark, including both light/dark themes,