Skip to content

Commit 0c8f194

Browse files
authored
Figure.basemap/Figure.grdview/Figure.plot3d: Migrate the 'zsize'/'zscale' parameters to the new alias system (#4205)
1 parent f56c922 commit 0c8f194

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

pygmt/src/basemap.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
from collections.abc import Sequence
66
from typing import Literal
77

8-
from pygmt.alias import AliasSystem
8+
from pygmt.alias import Alias, AliasSystem
99
from pygmt.clib import Session
1010
from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias
1111

1212

1313
@fmt_docstring
1414
@use_alias(
15-
Jz="zscale",
16-
JZ="zsize",
1715
L="map_scale",
1816
F="box",
1917
Td="rose",
@@ -25,6 +23,8 @@
2523
def basemap(
2624
self,
2725
projection: str | None = None,
26+
zsize: float | str | None = None,
27+
zscale: float | str | None = None,
2828
frame: str | Sequence[str] | bool = False,
2929
region: Sequence[float | str] | str | None = None,
3030
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
@@ -49,6 +49,8 @@ def basemap(
4949
{aliases}
5050
- B = frame
5151
- J = projection
52+
- Jz = zscale
53+
- JZ = zsize
5254
- R = region
5355
- V = verbose
5456
- c = panel
@@ -57,7 +59,7 @@ def basemap(
5759
Parameters
5860
----------
5961
{projection}
60-
zscale/zsize : float or str
62+
zscale/zsize
6163
Set z-axis scaling or z-axis size.
6264
{region}
6365
*Required if this is the first plot command.*
@@ -98,7 +100,10 @@ def basemap(
98100
"""
99101
self._activate_figure()
100102

101-
aliasdict = AliasSystem().add_common(
103+
aliasdict = AliasSystem(
104+
Jz=Alias(zscale, name="zscale"),
105+
JZ=Alias(zsize, name="zsize"),
106+
).add_common(
102107
B=frame,
103108
J=projection,
104109
R=region,

pygmt/src/grdview.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import xarray as xr
99
from pygmt._typing import PathLike
10-
from pygmt.alias import AliasSystem
10+
from pygmt.alias import Alias, AliasSystem
1111
from pygmt.clib import Session
1212
from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias
1313

@@ -16,8 +16,6 @@
1616

1717
@fmt_docstring
1818
@use_alias(
19-
Jz="zscale",
20-
JZ="zsize",
2119
C="cmap",
2220
G="drapegrid",
2321
N="plane",
@@ -35,6 +33,8 @@ def grdview(
3533
self,
3634
grid: PathLike | xr.DataArray,
3735
projection: str | None = None,
36+
zscale: float | str | None = None,
37+
zsize: float | str | None = None,
3838
frame: str | Sequence[str] | bool = False,
3939
region: Sequence[float | str] | str | None = None,
4040
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
@@ -57,6 +57,8 @@ def grdview(
5757
{aliases}
5858
- B = frame
5959
- J = projection
60+
- Jz = zscale
61+
- JZ = zsize
6062
- R = region
6163
- V = verbose
6264
- c = panel
@@ -71,7 +73,7 @@ def grdview(
7173
with ``perspective``, optionally append */zmin/zmax* to indicate the range to
7274
use for the 3-D axes [Default is the region given by the input grid].
7375
{projection}
74-
zscale/zsize : float or str
76+
zscale/zsize
7577
Set z-axis scaling or z-axis size.
7678
{frame}
7779
cmap : str
@@ -157,7 +159,10 @@ def grdview(
157159
"""
158160
self._activate_figure()
159161

160-
aliasdict = AliasSystem().add_common(
162+
aliasdict = AliasSystem(
163+
Jz=Alias(zscale, name="zscale"),
164+
JZ=Alias(zsize, name="zsize"),
165+
).add_common(
161166
B=frame,
162167
J=projection,
163168
R=region,

pygmt/src/plot3d.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
D="offset",
2727
G="fill",
2828
I="intensity",
29-
Jz="zscale",
30-
JZ="zsize",
3129
L="close",
3230
N="no_clip",
3331
Q="no_sort",
@@ -58,6 +56,8 @@ def plot3d( # noqa: PLR0912, PLR0913
5856
direction=None,
5957
straight_line: bool | Literal["x", "y"] = False,
6058
projection: str | None = None,
59+
zscale: float | str | None = None,
60+
zsize: float | str | None = None,
6161
frame: str | Sequence[str] | bool = False,
6262
region: Sequence[float | str] | str | None = None,
6363
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
@@ -93,6 +93,8 @@ def plot3d( # noqa: PLR0912, PLR0913
9393
- A = straight_line
9494
- B = frame
9595
- J = projection
96+
- Jz = zscale
97+
- JZ = zsize
9698
- R = region
9799
- V = verbose
98100
- c = panel
@@ -118,7 +120,7 @@ def plot3d( # noqa: PLR0912, PLR0913
118120
can be angle and length, azimuth and length, or x and y components,
119121
depending on the style options chosen.
120122
{projection}
121-
zscale/zsize : float or str
123+
zscale/zsize
122124
Set z-axis scaling or z-axis size.
123125
{region}
124126
straight_line
@@ -273,6 +275,8 @@ def plot3d( # noqa: PLR0912, PLR0913
273275

274276
aliasdict = AliasSystem(
275277
A=Alias(straight_line, name="straight_line"),
278+
Jz=Alias(zscale, name="zscale"),
279+
JZ=Alias(zsize, name="zsize"),
276280
).add_common(
277281
B=frame,
278282
J=projection,

0 commit comments

Comments
 (0)