Skip to content

Commit 7046f57

Browse files
committed
Migrate the 'panel' parameter to the new alias system
1 parent d998e7a commit 7046f57

22 files changed

+115
-62
lines changed

pygmt/src/basemap.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818
Td="rose",
1919
Tm="compass",
2020
V="verbose",
21-
c="panel",
2221
f="coltypes",
2322
p="perspective",
2423
t="transparency",
2524
)
26-
@kwargs_to_strings(R="sequence", c="sequence_comma", p="sequence")
27-
def basemap(self, projection=None, **kwargs):
25+
@kwargs_to_strings(R="sequence", p="sequence")
26+
def basemap(self, projection=None, panel=None, **kwargs):
2827
r"""
2928
Plot base maps and frames.
3029
@@ -40,6 +39,7 @@ def basemap(self, projection=None, **kwargs):
4039
4140
{aliases}
4241
- J=projection
42+
- c=panel
4343
4444
Parameters
4545
----------
@@ -86,6 +86,7 @@ def basemap(self, projection=None, **kwargs):
8686
self._activate_figure()
8787
aliasdict = AliasSystem(
8888
J=Alias(projection, name="projection"),
89+
c=Alias(panel, name="panel", separator=",", size=2),
8990
).merge(kwargs)
9091
with Session() as lib:
9192
lib.call_module(module="basemap", args=build_arg_list(aliasdict))

pygmt/src/coast.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@
3535
S="water",
3636
V="verbose",
3737
W="shorelines",
38-
c="panel",
3938
p="perspective",
4039
t="transparency",
4140
)
42-
@kwargs_to_strings(R="sequence", c="sequence_comma", p="sequence")
41+
@kwargs_to_strings(R="sequence", p="sequence")
4342
def coast(
4443
self,
4544
projection=None,
4645
resolution: Literal[
4746
"auto", "full", "high", "intermediate", "low", "crude", None
4847
] = None,
48+
panel=None,
4949
**kwargs,
5050
):
5151
r"""
@@ -69,6 +69,7 @@ def coast(
6969
7070
{aliases}
7171
- J=projection
72+
- c=panel
7273
7374
Parameters
7475
----------
@@ -218,6 +219,7 @@ def coast(
218219

219220
aliasdict = AliasSystem(
220221
J=Alias(projection, name="projection"),
222+
c=Alias(panel, name="panel", separator=",", size=2),
221223
).merge(kwargs)
222224

223225
with Session() as lib:

pygmt/src/colorbar.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@
2323
V="verbose",
2424
W="scale",
2525
Z="zfile",
26-
c="panel",
2726
p="perspective",
2827
t="transparency",
2928
)
30-
@kwargs_to_strings(
31-
R="sequence", G="sequence", I="sequence", c="sequence_comma", p="sequence"
32-
)
33-
def colorbar(self, projection=None, **kwargs):
29+
@kwargs_to_strings(R="sequence", G="sequence", I="sequence", p="sequence")
30+
def colorbar(self, projection=None, panel=None, **kwargs):
3431
r"""
3532
Plot gray scale or color scale bar.
3633
@@ -46,6 +43,7 @@ def colorbar(self, projection=None, **kwargs):
4643
4744
{aliases}
4845
- J=projection
46+
- c=panel
4947
5048
Parameters
5149
----------
@@ -149,6 +147,7 @@ def colorbar(self, projection=None, **kwargs):
149147

150148
aliasdict = AliasSystem(
151149
J=Alias(projection, name="projection"),
150+
c=Alias(panel, name="panel", separator=",", size=2),
152151
).merge(kwargs)
153152
with Session() as lib:
154153
lib.call_module(module="colorbar", args=build_arg_list(aliasdict))

pygmt/src/contour.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
V="verbose",
2828
W="pen",
2929
b="binary",
30-
c="panel",
3130
d="nodata",
3231
e="find",
3332
f="coltypes",
@@ -37,14 +36,15 @@
3736
p="perspective",
3837
t="transparency",
3938
)
40-
@kwargs_to_strings(R="sequence", c="sequence_comma", i="sequence_comma", p="sequence")
39+
@kwargs_to_strings(R="sequence", i="sequence_comma", p="sequence")
4140
def contour(
4241
self,
4342
data: PathLike | TableLike | None = None,
4443
x=None,
4544
y=None,
4645
z=None,
4746
projection=None,
47+
panel=None,
4848
**kwargs,
4949
):
5050
r"""
@@ -59,6 +59,7 @@ def contour(
5959
6060
{aliases}
6161
- J=projection
62+
- c=panel
6263
6364
Parameters
6465
----------
@@ -155,6 +156,7 @@ def contour(
155156

156157
aliasdict = AliasSystem(
157158
J=Alias(projection, name="projection"),
159+
c=Alias(panel, name="panel", separator=",", size=2),
158160
).merge(kwargs)
159161

160162
with Session() as lib:

pygmt/src/grdcontour.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@
3232
V="verbose",
3333
W="pen",
3434
l="label",
35-
c="panel",
3635
f="coltypes",
3736
p="perspective",
3837
t="transparency",
3938
)
40-
@kwargs_to_strings(R="sequence", L="sequence", c="sequence_comma", p="sequence")
41-
def grdcontour(self, grid: PathLike | xr.DataArray, projection=None, **kwargs):
39+
@kwargs_to_strings(R="sequence", L="sequence", p="sequence")
40+
def grdcontour(
41+
self, grid: PathLike | xr.DataArray, projection=None, panel=None, **kwargs
42+
):
4243
r"""
4344
Make contour map using a grid.
4445
@@ -48,6 +49,7 @@ def grdcontour(self, grid: PathLike | xr.DataArray, projection=None, **kwargs):
4849
4950
{aliases}
5051
- J=projection
52+
- c=panel
5153
5254
Parameters
5355
----------
@@ -154,6 +156,7 @@ def grdcontour(self, grid: PathLike | xr.DataArray, projection=None, **kwargs):
154156

155157
aliasdict = AliasSystem(
156158
J=Alias(projection, name="projection"),
159+
c=Alias(panel, name="panel", separator=",", size=2),
157160
).merge(kwargs)
158161

159162
with Session() as lib:

pygmt/src/grdimage.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@
3131
R="region",
3232
V="verbose",
3333
n="interpolation",
34-
c="panel",
3534
f="coltypes",
3635
p="perspective",
3736
t="transparency",
3837
x="cores",
3938
)
40-
@kwargs_to_strings(R="sequence", c="sequence_comma", p="sequence")
41-
def grdimage(self, grid: PathLike | xr.DataArray, projection=None, **kwargs):
39+
@kwargs_to_strings(R="sequence", p="sequence")
40+
def grdimage(
41+
self, grid: PathLike | xr.DataArray, projection=None, panel=None, **kwargs
42+
):
4243
r"""
4344
Project and plot grids or images.
4445
@@ -74,6 +75,7 @@ def grdimage(self, grid: PathLike | xr.DataArray, projection=None, **kwargs):
7475
7576
{aliases}
7677
- J=projection
78+
- c=panel
7779
7880
Parameters
7981
----------
@@ -169,6 +171,7 @@ def grdimage(self, grid: PathLike | xr.DataArray, projection=None, **kwargs):
169171

170172
aliasdict = AliasSystem(
171173
J=Alias(projection, name="projection"),
174+
c=Alias(panel, name="panel", separator=",", size=2),
172175
).merge(kwargs)
173176

174177
with Session() as lib:

pygmt/src/grdview.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@
2626
Wf="facadepen",
2727
I="shading",
2828
V="verbose",
29-
c="panel",
3029
f="coltypes",
3130
n="interpolation",
3231
p="perspective",
3332
t="transparency",
3433
)
35-
@kwargs_to_strings(R="sequence", c="sequence_comma", p="sequence")
36-
def grdview(self, grid: PathLike | xr.DataArray, projection=None, **kwargs):
34+
@kwargs_to_strings(R="sequence", p="sequence")
35+
def grdview(self, grid: PathLike | xr.DataArray, projection=None, panel=None, **kwargs):
3736
r"""
3837
Create 3-D perspective image or surface mesh from a grid.
3938
@@ -47,6 +46,7 @@ def grdview(self, grid: PathLike | xr.DataArray, projection=None, **kwargs):
4746
4847
{aliases}
4948
- J=projection
49+
- c=panel
5050
5151
Parameters
5252
----------
@@ -145,6 +145,7 @@ def grdview(self, grid: PathLike | xr.DataArray, projection=None, **kwargs):
145145

146146
aliasdict = AliasSystem(
147147
J=Alias(projection, name="projection"),
148+
c=Alias(panel, name="panel", separator=",", size=2),
148149
).merge(kwargs)
149150

150151
with Session() as lib:

pygmt/src/histogram.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
W="pen",
2828
Z="histtype",
2929
b="binary",
30-
c="panel",
3130
d="nodata",
3231
e="find",
3332
h="header",
@@ -37,17 +36,16 @@
3736
t="transparency",
3837
w="wrap",
3938
)
40-
@kwargs_to_strings(
41-
R="sequence", T="sequence", c="sequence_comma", i="sequence_comma", p="sequence"
42-
)
43-
def histogram(self, data: PathLike | TableLike, projection=None, **kwargs):
39+
@kwargs_to_strings(R="sequence", T="sequence", i="sequence_comma", p="sequence")
40+
def histogram(self, data: PathLike | TableLike, projection=None, panel=None, **kwargs):
4441
r"""
4542
Calculate and plot histograms.
4643
4744
Full GMT docs at :gmt-docs:`histogram.html`.
4845
4946
{aliases}
5047
- J=projection
48+
- c=panel
5149
5250
Parameters
5351
----------
@@ -140,6 +138,7 @@ def histogram(self, data: PathLike | TableLike, projection=None, **kwargs):
140138

141139
aliasdict = AliasSystem(
142140
J=Alias(projection, name="projection"),
141+
c=Alias(panel, name="panel", separator=",", size=2),
143142
).merge(kwargs)
144143

145144
with Session() as lib:

pygmt/src/image.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
M="monochrome",
1717
R="region",
1818
V="verbose",
19-
c="panel",
2019
p="perspective",
2120
t="transparency",
2221
)
23-
@kwargs_to_strings(R="sequence", c="sequence_comma", p="sequence")
24-
def image(self, imagefile: PathLike, projection=None, **kwargs):
22+
@kwargs_to_strings(R="sequence", p="sequence")
23+
def image(self, imagefile: PathLike, projection=None, panel=None, **kwargs):
2524
r"""
2625
Plot raster or EPS images.
2726
@@ -32,6 +31,7 @@ def image(self, imagefile: PathLike, projection=None, **kwargs):
3231
3332
{aliases}
3433
- J=projection
34+
- c=panel
3535
3636
Parameters
3737
----------
@@ -73,6 +73,7 @@ def image(self, imagefile: PathLike, projection=None, **kwargs):
7373

7474
aliasdict = AliasSystem(
7575
J=Alias(projection, name="projection"),
76+
c=Alias(panel, name="panel", separator=",", size=2),
7677
).merge(kwargs)
7778

7879
with Session() as lib:

pygmt/src/legend.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
D="position",
2525
F="box",
2626
V="verbose",
27-
c="panel",
2827
p="perspective",
2928
t="transparency",
3029
)
31-
@kwargs_to_strings(R="sequence", c="sequence_comma", p="sequence")
30+
@kwargs_to_strings(R="sequence", p="sequence")
3231
def legend(
3332
self,
3433
spec: PathLike | io.StringIO | None = None,
3534
projection=None,
3635
position="JTR+jTR+o0.2c",
3736
box="+gwhite+p1p",
37+
panel=None,
3838
**kwargs,
3939
):
4040
r"""
@@ -50,6 +50,7 @@ def legend(
5050
5151
{aliases}
5252
- J=projection
53+
- c=panel
5354
5455
Parameters
5556
----------
@@ -101,6 +102,7 @@ def legend(
101102

102103
aliasdict = AliasSystem(
103104
J=Alias(projection, name="projection"),
105+
c=Alias(panel, name="panel", separator=",", size=2),
104106
).merge(kwargs)
105107

106108
with Session() as lib:

0 commit comments

Comments
 (0)