2
2
plot3d - Plot lines, polygons, and symbols in 3-D.
3
3
"""
4
4
5
+ from collections .abc import Sequence
5
6
from typing import Literal
6
7
7
8
from pygmt ._typing import PathLike , TableLike
45
46
i = "incols" ,
46
47
l = "label" ,
47
48
p = "perspective" ,
48
- t = "transparency" ,
49
49
w = "wrap" ,
50
50
)
51
51
@kwargs_to_strings (R = "sequence" , i = "sequence_comma" , p = "sequence" )
@@ -63,6 +63,7 @@ def plot3d( # noqa: PLR0912, PLR0913
63
63
verbose : Literal ["quiet" , "error" , "warning" , "timing" , "info" , "compat" , "debug" ]
64
64
| bool = False ,
65
65
panel : int | tuple [int , int ] | bool = False ,
66
+ transparency : float | Sequence [float ] | bool | None = None ,
66
67
** kwargs ,
67
68
):
68
69
r"""
@@ -93,6 +94,7 @@ def plot3d( # noqa: PLR0912, PLR0913
93
94
- J = projection
94
95
- V = verbose
95
96
- c = panel
97
+ - t = transparency
96
98
97
99
Parameters
98
100
----------
@@ -206,9 +208,8 @@ def plot3d( # noqa: PLR0912, PLR0913
206
208
{label}
207
209
{perspective}
208
210
{transparency}
209
- ``transparency`` can also be a 1-D array to set varying
210
- transparency for symbols, but this option is only valid if using
211
- ``x``/``y``/``z``.
211
+ ``transparency`` can also be a 1-D array to set varying transparency for
212
+ symbols, but this option is only valid if using ``x``/``y``/``z``.
212
213
{wrap}
213
214
"""
214
215
# TODO(GMT>6.5.0): Remove the note for the upstream bug of the "straight_line"
@@ -232,11 +233,14 @@ def plot3d( # noqa: PLR0912, PLR0913
232
233
# Size
233
234
if is_nonstr_iter (size ):
234
235
data ["size" ] = size
235
- # Intensity and transparency
236
- for flag , name in [("I" , "intensity" ), ("t" , "transparency" )]:
237
- if is_nonstr_iter (kwargs .get (flag )):
238
- data [name ] = kwargs [flag ]
239
- kwargs [flag ] = ""
236
+ # Intensity
237
+ if is_nonstr_iter (kwargs .get ("I" )):
238
+ data ["intensity" ] = kwargs ["I" ]
239
+ kwargs ["I" ] = ""
240
+ # Transparency
241
+ if is_nonstr_iter (transparency ):
242
+ data ["transparency" ] = transparency
243
+ transparency = True
240
244
# Symbol must be at the last column
241
245
if is_nonstr_iter (symbol ):
242
246
if "S" not in kwargs :
@@ -252,7 +256,7 @@ def plot3d( # noqa: PLR0912, PLR0913
252
256
("fill" , kwargs .get ("G" )),
253
257
("size" , size ),
254
258
("intensity" , kwargs .get ("I" )),
255
- ("transparency" , kwargs . get ( "t" ) ),
259
+ ("transparency" , transparency ),
256
260
("symbol" , symbol ),
257
261
]:
258
262
if is_nonstr_iter (value ):
@@ -271,6 +275,7 @@ def plot3d( # noqa: PLR0912, PLR0913
271
275
J = projection ,
272
276
V = verbose ,
273
277
c = panel ,
278
+ t = transparency ,
274
279
)
275
280
aliasdict .merge (kwargs )
276
281
0 commit comments