diff --git a/pygmt/src/pygmtlogo.py b/pygmt/src/pygmtlogo.py index bf94b2c4c78..ec1bb7d9250 100644 --- a/pygmt/src/pygmtlogo.py +++ b/pygmt/src/pygmtlogo.py @@ -32,8 +32,13 @@ def _create_logo( # noqa: PLR0915 # Helpful definitions size = 4 - region = [-size, size] * 2 proj = "x1c" + region = { + "horizontal": [-size, size * 8.0, -size, size], + "vertical": [-size, size, -size * 1.75, size], + "none": [-size, size, -size, size], + }[wordmark] + # Rotation around z-axis by 30 degrees counter-clockwise placed in the center. perspective = "30+w0/0" @@ -77,7 +82,7 @@ def _create_logo( # noqa: PLR0915 font = "AvantGarde-Book" match wordmark: case "vertical": - args_text_wm = {"x": 0, "y": -4.5, "justify": "CT", "font": f"2.5c,{font}"} + args_text_wm = {"x": 0, "y": -4.5, "justify": "CT", "font": f"2.4c,{font}"} case "horizontal": args_text_wm = {"x": 4.5, "y": 0.8, "justify": "LM", "font": f"8c,{font}"} @@ -224,8 +229,7 @@ def _compass_lines(): # Add wordmark "PyGMT" if wordmark != "none": - text_wm = f"@;{color_py};Py@;;@;{color_gmt};GMT@;;" - fig.text(text=text_wm, no_clip=True, **args_text_wm) + fig.text(text=f"@;{color_py};Py@;;@;{color_gmt};GMT@;;", **args_text_wm) # Helpful for implementing the logo; not included in the logo if debug: @@ -240,8 +244,10 @@ def _compass_lines(): pen = "0.3p,gray30,2_2" fig.plot(x=0, y=0, style=f"c{2 * (r2 + (r3 - r4))}c", pen=pen) # Lines for letter M - fig.hlines(y=[r4, r5], xmin=-3, pen=pen, perspective=True) - fig.vlines(x=[r4, (thick_gap + r4) / 2], ymax=3, pen=pen, perspective=True) + size_s = 0.9 * size + fig.hlines(y=[r4, r5], xmin=-size_s, xmax=size_s, pen=pen, perspective=True) + m_mid = (thick_gap + r4) / 2 + fig.vlines(x=[r4, m_mid], ymin=-size_s, ymax=size_s, pen=pen, perspective=True) if figname: fig.savefig(fname=figname) diff --git a/pygmt/tests/baseline/test_pygmtlogo_circle_design.png.dvc b/pygmt/tests/baseline/test_pygmtlogo_circle_design.png.dvc deleted file mode 100644 index 8f3e5ef22e7..00000000000 --- a/pygmt/tests/baseline/test_pygmtlogo_circle_design.png.dvc +++ /dev/null @@ -1,5 +0,0 @@ -outs: -- md5: 459b74dee35adcb7f3519269ad49668d - size: 149831 - hash: md5 - path: test_pygmtlogo_circle_design.png diff --git a/pygmt/tests/baseline/test_pygmtlogo_circle_design_horizontal.png.dvc b/pygmt/tests/baseline/test_pygmtlogo_circle_design_horizontal.png.dvc new file mode 100644 index 00000000000..3648ff8045d --- /dev/null +++ b/pygmt/tests/baseline/test_pygmtlogo_circle_design_horizontal.png.dvc @@ -0,0 +1,5 @@ +outs: +- md5: de3f281a09815faff7fed339c1635bc5 + size: 336254 + hash: md5 + path: test_pygmtlogo_circle_design_horizontal.png diff --git a/pygmt/tests/baseline/test_pygmtlogo_circle_design_vertical.png.dvc b/pygmt/tests/baseline/test_pygmtlogo_circle_design_vertical.png.dvc new file mode 100644 index 00000000000..dc0b53a0cd7 --- /dev/null +++ b/pygmt/tests/baseline/test_pygmtlogo_circle_design_vertical.png.dvc @@ -0,0 +1,5 @@ +outs: +- md5: dd09fa24c575eabac7659dc49f313f5f + size: 173671 + hash: md5 + path: test_pygmtlogo_circle_design_vertical.png diff --git a/pygmt/tests/test_pygmtlogo.py b/pygmt/tests/test_pygmtlogo.py index e4d6f4aff5e..71078f95548 100644 --- a/pygmt/tests/test_pygmtlogo.py +++ b/pygmt/tests/test_pygmtlogo.py @@ -9,15 +9,16 @@ @pytest.mark.mpl_image_compare(savefig_kwargs={"dpi": 600}) -def test_pygmtlogo_circle_design(): +@pytest.mark.parametrize("wordmark", ["horizontal", "vertical"]) +def test_pygmtlogo_circle_design(wordmark): """ - Test the design details of the PyGMT circular logo. + Test the design details of the PyGMT circular logo, with a wordmark. This is a regression test to ensure that the design of the logo does not change unintentionally. The debugging lines (gridlines and circles) are helpful for implementing the logo, but they are not included in the final logo design. """ - fig = _create_logo(debug=True) + fig = _create_logo(debug=True, wordmark=wordmark) return fig