Skip to content

Commit aafb290

Browse files
committed
Set default logo size to 2-cm if not set
1 parent 2ce4d93 commit aafb290

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

pygmt/src/pygmtlogo.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import numpy as np
1212
from pygmt._typing import AnchorCode, PathLike
13+
from pygmt.exceptions import GMTValueError
1314
from pygmt.helpers import GMTTempFile, fmt_docstring
1415
from pygmt.params import Box, Position
1516

@@ -304,7 +305,8 @@ def pygmtlogo( # noqa: PLR0913
304305
width
305306
height
306307
Width or height of the PyGMT logo. Since the aspect ratio is fixed, only one of
307-
the two can be specified.
308+
the two can be specified. If not specified, the default size of the visual logo
309+
is set to 2 cm.
308310
box
309311
Draw a background box behind the logo. If set to ``True``, a simple rectangular
310312
box is drawn using :gmt-term:`MAP_FRAME_PEN`. To customize the box appearance,
@@ -333,6 +335,20 @@ def pygmtlogo( # noqa: PLR0913
333335
>>> fig.pygmtlogo(wordmark="horizontal", position="BR", height="1c")
334336
>>> fig.show()
335337
"""
338+
# Set the default size of the visual logo to 2 cm.
339+
if width is None and height is None:
340+
match wordmark:
341+
case "none" | "vertical":
342+
width = width or "2c"
343+
case "horizontal":
344+
height = height or "2c"
345+
case _:
346+
raise GMTValueError(
347+
wordmark,
348+
description="value for wordmark",
349+
choices={"none", "horizontal", "vertical"},
350+
)
351+
336352
with GMTTempFile(suffix=".eps") as logofile:
337353
# Create logo file
338354
_create_logo(
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
outs:
2-
- md5: f71418c9c7566665086b6b250cc564c4
3-
size: 18618
2+
- md5: b1dee02932b292335cf5f8b95676a258
3+
size: 19161
44
hash: md5
55
path: test_pygmtlogo_circle_no_wordmark.png

0 commit comments

Comments
 (0)