22logo - Plot the GMT logo.
33"""
44
5+ from typing import Literal
6+
7+ from pygmt .alias import Alias , AliasSystem
58from pygmt .clib import Session
9+ from pygmt .exceptions import GMTInvalidInput
610from pygmt .helpers import build_arg_list , fmt_docstring , kwargs_to_strings , use_alias
711
812
913@fmt_docstring
1014@use_alias (
1115 R = "region" ,
1216 J = "projection" ,
13- D = "position" ,
1417 F = "box" ,
1518 S = "style" ,
1619 V = "verbose" ,
1720 c = "panel" ,
1821 t = "transparency" ,
1922)
2023@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+ ):
2236 r"""
2337 Plot the GMT logo.
2438
@@ -39,6 +53,9 @@ def logo(self, **kwargs):
3953 [**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\
4054 **+w**\ *width*\ [**+j**\ *justify*]\ [**+o**\ *dx*\ [/*dy*]].
4155 Set reference point on the map for the image.
56+ positon_type
57+ width/height
58+ Width or height of the GMT logo.
4259 box : bool or str
4360 If set to ``True``, draw a rectangular border around the
4461 GMT logo.
@@ -55,5 +72,30 @@ def logo(self, **kwargs):
5572 {transparency}
5673 """
5774 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+
58100 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