Skip to content

Commit 8bc5a82

Browse files
Plot vertical line and arrow head as one polygon
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
1 parent 160dcdf commit 8bc5a82

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

pygmt/src/pygmtlogo.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,12 @@ def _bg_arrow_coords():
147147
# x0, y0 is the same as in _letter_t_coords().
148148
x0 = thick_gt / 2
149149
y0 = 1.8 * x0 * np.sqrt(3)
150-
arrow_x = [
151-
-x0 * 2 - thick_comp / 2,
152-
-thick_comp / 2,
153-
thick_comp / 2,
154-
x0 * 2 + thick_comp / 2,
155-
]
156-
arrow_y = [-r0 + y0, -r0, -r0, -r0 + y0]
150+
# The background arrow is thick_comp wide than the letter T.
151+
x1 = x0 + thick_comp / 2.0 # Half-width of the arrow tail
152+
x2 = 2 * x0 + thick_comp / np.sqrt(3) # Half-width of the arrow head
153+
154+
arrow_x = [-x1, -x1, -x2, -(x2 - 2 * x0), (x2 - 2 * x0), x2, x1, x1]
155+
arrow_y = [r0, -r0 + y0, -r0 + y0, -r0, -r0, -r0 + y0, -r0 + y0, r0]
157156
return {"x": arrow_x, "y": arrow_y}
158157

159158
def _compass_lines():
@@ -170,11 +169,11 @@ def _compass_lines():
170169
(x1, -x1, x2, -x2), # lower right
171170
]
172171

173-
def _vline_coords(gap=0):
172+
def _vline_coords():
174173
"""
175-
Coordinates for vertical lines.
174+
Coordinates for the vertical line at the top.
176175
"""
177-
x0 = (thick_gt + gap) / 2
176+
x0 = thick_gt / 2
178177
return {"x": [-x0, -x0, x0, x0], "y": [r0, r3, r3, r0]}
179178

180179
fig = pygmt.Figure()
@@ -202,8 +201,7 @@ def _vline_coords(gap=0):
202201
fig.plot(x=0, y=0, pen=f"{thick_shape}c,{blue}", **args_shape)
203202
# fig.show()
204203

205-
# Background vertical line and arrow head
206-
fig.plot(data=_vline_coords(gap=thick_comp), fill=color_bg, perspective=True)
204+
# Arrow in background color (over shape outline but under letters)
207205
fig.plot(data=_bg_arrow_coords(), fill=color_bg, perspective=True)
208206

209207
# Letters G, M, and T

0 commit comments

Comments
 (0)