Skip to content

Commit cd9285d

Browse files
authored
Figure.colorbar: Migrate the 'truncate' parameter to the new alias system (#4216)
1 parent 671d1b6 commit cd9285d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pygmt/src/colorbar.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,17 @@
77

88
from pygmt.alias import Alias, AliasSystem
99
from pygmt.clib import Session
10-
from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias
10+
from pygmt.helpers import build_arg_list, fmt_docstring, use_alias
1111
from pygmt.params import Box
1212

1313
__doctest_skip__ = ["colorbar"]
1414

1515

1616
@fmt_docstring
17-
@use_alias(
18-
C="cmap", D="position", G="truncate", L="equalsize", Q="log", W="scale", Z="zfile"
19-
)
20-
@kwargs_to_strings(G="sequence", I="sequence")
21-
def colorbar(
17+
@use_alias(C="cmap", D="position", L="equalsize", Q="log", W="scale", Z="zfile")
18+
def colorbar( # noqa: PLR0913
2219
self,
20+
truncate: Sequence[float] | None = None,
2321
shading: float | Sequence[float] | bool = False,
2422
projection: str | None = None,
2523
box: Box | bool = False,
@@ -59,6 +57,7 @@ def colorbar(
5957
{aliases}
6058
- B = frame
6159
- F = box
60+
- G = truncate
6261
- I = shading
6362
- J = projection
6463
- R = region
@@ -99,11 +98,11 @@ def colorbar(
9998
rectangular box is drawn using :gmt-term:`MAP_FRAME_PEN`. To customize the box
10099
appearance, pass a :class:`pygmt.params.Box` object to control style, fill, pen,
101100
and other box properties.
102-
truncate : list or str
103-
*zlo*/*zhi*.
104-
Truncate the incoming CPT so that the lowest and highest z-levels are
105-
to *zlo* and *zhi*. If one of these equal NaN then we leave that end of
106-
the CPT alone. The truncation takes place before the plotting.
101+
truncate
102+
(*zlow*, *zhigh*).
103+
Truncate the incoming CPT so that the lowest and highest z-levels are to *zlow*
104+
and *zhigh*. If one of these equal NaN then we leave that end of the CPT alone.
105+
The truncation takes place before the plotting.
107106
scale : float
108107
Multiply all z-values in the CPT by the provided scale. By default,
109108
the CPT is used as is.
@@ -161,6 +160,7 @@ def colorbar(
161160

162161
aliasdict = AliasSystem(
163162
F=Alias(box, name="box"),
163+
G=Alias(truncate, name="truncate", sep="/", size=2),
164164
I=Alias(shading, name="shading", sep="/", size=2),
165165
).add_common(
166166
B=frame,

0 commit comments

Comments
 (0)