Skip to content

Commit c0803a6

Browse files
authored
Figure.plot/Figure.plot3d: Refactor the straight_line parameter to the new alias system (#4067)
1 parent 613b623 commit c0803a6

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

pygmt/src/plot.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import Literal
66

77
from pygmt._typing import PathLike, TableLike
8-
from pygmt.alias import AliasSystem
8+
from pygmt.alias import Alias, AliasSystem
99
from pygmt.clib import Session
1010
from pygmt.exceptions import GMTInvalidInput, GMTTypeError
1111
from pygmt.helpers import (
@@ -21,7 +21,6 @@
2121

2222
@fmt_docstring
2323
@use_alias(
24-
A="straight_line",
2524
B="frame",
2625
C="cmap",
2726
D="offset",
@@ -57,7 +56,7 @@ def plot( # noqa: PLR0912, PLR0913
5756
size=None,
5857
symbol=None,
5958
direction=None,
60-
straight_line: bool | Literal["x", "y"] = False, # noqa: ARG001
59+
straight_line: bool | Literal["x", "y"] = False,
6160
projection=None,
6261
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
6362
| bool = False,
@@ -88,6 +87,7 @@ def plot( # noqa: PLR0912, PLR0913
8887
Full GMT docs at :gmt-docs:`plot.html`.
8988
9089
{aliases}
90+
- A = straight_line
9191
- J = projection
9292
- V = verbose
9393
- c = panel
@@ -286,7 +286,9 @@ def plot( # noqa: PLR0912, PLR0913
286286
if kwargs.get("S") is None and _data_geometry_is_point(data, kind):
287287
kwargs["S"] = "s0.2c"
288288

289-
aliasdict = AliasSystem().add_common(
289+
aliasdict = AliasSystem(
290+
A=Alias(straight_line, name="straight_line"),
291+
).add_common(
290292
J=projection,
291293
V=verbose,
292294
c=panel,

pygmt/src/plot3d.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import Literal
66

77
from pygmt._typing import PathLike, TableLike
8-
from pygmt.alias import AliasSystem
8+
from pygmt.alias import Alias, AliasSystem
99
from pygmt.clib import Session
1010
from pygmt.exceptions import GMTInvalidInput, GMTTypeError
1111
from pygmt.helpers import (
@@ -21,7 +21,6 @@
2121

2222
@fmt_docstring
2323
@use_alias(
24-
A="straight_line",
2524
B="frame",
2625
C="cmap",
2726
D="offset",
@@ -59,7 +58,7 @@ def plot3d( # noqa: PLR0912, PLR0913
5958
size=None,
6059
symbol=None,
6160
direction=None,
62-
straight_line: bool | Literal["x", "y"] = False, # noqa: ARG001
61+
straight_line: bool | Literal["x", "y"] = False,
6362
projection=None,
6463
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
6564
| bool = False,
@@ -90,6 +89,7 @@ def plot3d( # noqa: PLR0912, PLR0913
9089
Full GMT docs at :gmt-docs:`plot3d.html`.
9190
9291
{aliases}
92+
- A = straight_line
9393
- J = projection
9494
- V = verbose
9595
- c = panel
@@ -265,7 +265,9 @@ def plot3d( # noqa: PLR0912, PLR0913
265265
if kwargs.get("S") is None and _data_geometry_is_point(data, kind):
266266
kwargs["S"] = "u0.2c"
267267

268-
aliasdict = AliasSystem().add_common(
268+
aliasdict = AliasSystem(
269+
A=Alias(straight_line, name="straight_line"),
270+
).add_common(
269271
J=projection,
270272
V=verbose,
271273
c=panel,

0 commit comments

Comments
 (0)