2
2
logo - Plot the GMT logo.
3
3
"""
4
4
5
+ from typing import Literal
6
+
7
+ from pygmt .alias import Alias , AliasSystem
5
8
from pygmt .clib import Session
9
+ from pygmt .exceptions import GMTInvalidInput
6
10
from pygmt .helpers import build_arg_list , fmt_docstring , kwargs_to_strings , use_alias
7
11
8
12
9
13
@fmt_docstring
10
14
@use_alias (
11
15
R = "region" ,
12
16
J = "projection" ,
13
- D = "position" ,
14
17
F = "box" ,
15
18
S = "style" ,
16
19
V = "verbose" ,
17
20
c = "panel" ,
18
21
t = "transparency" ,
19
22
)
20
23
@kwargs_to_strings (R = "sequence" , c = "sequence_comma" , p = "sequence" )
21
- def logo (self , ** kwargs ):
24
+ def logo (
25
+ self ,
26
+ position_type : Literal [
27
+ "user" , "justify" , "mirror" , "normalize" , "plot" , None
28
+ ] = None ,
29
+ position = None ,
30
+ height = None ,
31
+ width = None ,
32
+ justify = None ,
33
+ offset = None ,
34
+ ** kwargs ,
35
+ ):
22
36
r"""
23
37
Plot the GMT logo.
24
38
@@ -39,6 +53,9 @@ def logo(self, **kwargs):
39
53
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\
40
54
**+w**\ *width*\ [**+j**\ *justify*]\ [**+o**\ *dx*\ [/*dy*]].
41
55
Set reference point on the map for the image.
56
+ positon_type
57
+ width/height
58
+ Width or height of the GMT logo.
42
59
box : bool or str
43
60
If set to ``True``, draw a rectangular border around the
44
61
GMT logo.
@@ -55,5 +72,30 @@ def logo(self, **kwargs):
55
72
{transparency}
56
73
"""
57
74
self ._activate_figure ()
75
+ if width is not None and height is not None :
76
+ msg = "Cannot specify both width and height."
77
+ raise GMTInvalidInput (msg )
78
+
79
+ aliasdict = AliasSystem (
80
+ D = [
81
+ Alias (
82
+ position_type ,
83
+ name = "position_type" ,
84
+ mapping = {
85
+ "user" : "g" ,
86
+ "justify" : "j" ,
87
+ "mirror" : "J" ,
88
+ "normalize" : "n" ,
89
+ "plot" : "x" ,
90
+ },
91
+ ),
92
+ Alias (position , name = "position" , separator = "/" ),
93
+ Alias (height , name = "height" , prefix = "+h" ),
94
+ Alias (width , name = "width" , prefix = "+w" ),
95
+ Alias (justify , name = "justify" , prefix = "+j" ),
96
+ Alias (offset , name = "offset" , prefix = "+o" , separator = "/" , size = 2 ),
97
+ ]
98
+ ).merge (kwargs )
99
+
58
100
with Session () as lib :
59
- lib .call_module (module = "logo" , args = build_arg_list (kwargs ))
101
+ lib .call_module (module = "logo" , args = build_arg_list (aliasdict ))
0 commit comments