Skip to content

Commit 4c060ca

Browse files
committed
Figure.pygmtlogo: Specify the angle of compass lines for readability
1 parent 21cb57a commit 4c060ca

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

pygmt/src/pygmtlogo.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,19 @@ def _bg_arrow_coords():
154154

155155
def _compass_lines():
156156
"""Coordinates of compass lines."""
157-
sqrt2 = np.sqrt(2) / 2
158-
x1, x2, x3 = r0 * sqrt2, r3 * sqrt2, (r2 + (r3 - r4)) * sqrt2
157+
angle = np.deg2rad(45.0) # Angle of diagonal compass lines
158+
sinx, cosx = np.sin(angle), np.cos(angle)
159+
160+
x1, x2, x3 = r0 * sinx, r3 * sinx, (r2 + (r3 - r4)) * sinx
161+
y1, y2, y3 = r0 * cosx, r3 * cosx, (r2 + (r3 - r4)) * cosx
159162
# Coordinates of vectors in the format of (x_start, y_start, x_end, y_end).
160163
return [
161164
(-r0 * hex_factor, 0, -r3, 0), # left horizontal
162165
(r3, 0, r0 * hex_factor, 0), # right horizontal
163-
(-x1, x1, -x2, x2), # upper left
164-
(-x1, -x1, -x2, -x2), # lower left
165-
(x1, x1, x3, x3), # upper right
166-
(x1, -x1, x2, -x2), # lower right
166+
(-x1, y1, -x2, y2), # upper left
167+
(-x1, -y1, -x2, -y2), # lower left
168+
(x1, y1, x3, y3), # upper right
169+
(x1, -y1, x2, -y2), # lower right
167170
]
168171

169172
def _vline_coords():

0 commit comments

Comments
 (0)