Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions pygmt/src/pygmtlogo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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}"}

Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down
5 changes: 0 additions & 5 deletions pygmt/tests/baseline/test_pygmtlogo_circle_design.png.dvc

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
outs:
- md5: de3f281a09815faff7fed339c1635bc5
size: 336254
hash: md5
path: test_pygmtlogo_circle_design_horizontal.png
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
outs:
- md5: dd09fa24c575eabac7659dc49f313f5f
size: 173671
hash: md5
path: test_pygmtlogo_circle_design_vertical.png
7 changes: 4 additions & 3 deletions pygmt/tests/test_pygmtlogo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading