|
10 | 10 |
|
11 | 11 | import numpy as np |
12 | 12 | from pygmt._typing import AnchorCode, PathLike |
| 13 | +from pygmt.exceptions import GMTValueError |
13 | 14 | from pygmt.helpers import GMTTempFile, fmt_docstring |
14 | 15 | from pygmt.params import Box, Position |
15 | 16 |
|
@@ -304,7 +305,8 @@ def pygmtlogo( # noqa: PLR0913 |
304 | 305 | width |
305 | 306 | height |
306 | 307 | 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. |
308 | 310 | box |
309 | 311 | Draw a background box behind the logo. If set to ``True``, a simple rectangular |
310 | 312 | box is drawn using :gmt-term:`MAP_FRAME_PEN`. To customize the box appearance, |
@@ -333,6 +335,20 @@ def pygmtlogo( # noqa: PLR0913 |
333 | 335 | >>> fig.pygmtlogo(wordmark="horizontal", position="BR", height="1c") |
334 | 336 | >>> fig.show() |
335 | 337 | """ |
| 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 | + |
336 | 352 | with GMTTempFile(suffix=".eps") as logofile: |
337 | 353 | # Create logo file |
338 | 354 | _create_logo( |
|
0 commit comments