Skip to content

Commit 958c936

Browse files
committed
Figure.basemap/Figure.coast: Deprecate the 'map_scale' parameter. Use 'Figure.scalebar' instead.
1 parent 613bdc1 commit 958c936

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

pygmt/src/basemap.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,15 @@
1111

1212

1313
@fmt_docstring
14-
@use_alias(
15-
L="map_scale",
16-
F="box",
17-
Td="rose",
18-
Tm="compass",
19-
f="coltypes",
20-
)
21-
def basemap(
14+
@use_alias(F="box", Td="rose", Tm="compass", f="coltypes")
15+
def basemap( # noqa: PLR0913
2216
self,
2317
projection: str | None = None,
2418
zsize: float | str | None = None,
2519
zscale: float | str | None = None,
2620
frame: str | Sequence[str] | bool = False,
2721
region: Sequence[float | str] | str | None = None,
22+
map_scale: str | None = None,
2823
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
2924
| bool = False,
3025
panel: int | Sequence[int] | bool = False,
@@ -35,13 +30,16 @@ def basemap(
3530
r"""
3631
Plot base maps and frames.
3732
38-
Creates a basic or fancy basemap with axes, fill, and titles. Several
39-
map projections are available, and the user may specify separate
40-
tick-mark intervals for boundary annotation, ticking, and [optionally]
41-
gridlines. A simple map scale or directional rose may also be plotted.
33+
Creates a basic or fancy basemap with axes, fill, and titles. Several map
34+
projections are available, and the user may specify separate tick-mark intervals for
35+
boundary annotation, ticking, and [optionally] gridlines.
4236
43-
At least one of the parameters ``frame``, ``map_scale``, ``rose``, or
44-
``compass`` must be specified if not in subplot mode.
37+
At least one of the parameters ``frame``, ``map_scale``, ``rose``, or ``compass``
38+
must be specified if not in subplot mode.
39+
40+
See also the following methods that wraps the GMT's ``basemap`` module:
41+
42+
- :meth:`pygmt.Figure.scalebar`: Add a scale bar on the plot.
4543
4644
Full GMT docs at :gmt-docs:`basemap.html`.
4745
@@ -50,6 +48,7 @@ def basemap(
5048
- J = projection
5149
- Jz = zscale
5250
- JZ = zsize
51+
- L = map_scale
5352
- R = region
5453
- V = verbose
5554
- c = panel
@@ -64,10 +63,13 @@ def basemap(
6463
$region
6564
*Required if this is the first plot command.*
6665
$frame
67-
map_scale : str
68-
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\
69-
**+w**\ *length*.
66+
map_scale
7067
Draw a simple map scale centered on the reference point specified.
68+
69+
.. deprecated:: v0.19.0
70+
71+
Recommended to use :meth:`pygmt.Figure.scalebar` instead.
72+
7173
box : bool or str
7274
[**+c**\ *clearances*][**+g**\ *fill*][**+i**\ [[*gap*/]\ *pen*]]\
7375
[**+p**\ [*pen*]][**+r**\ [*radius*]][**+s**\ [[*dx*/*dy*/][*shade*]]].
@@ -103,6 +105,7 @@ def basemap(
103105
aliasdict = AliasSystem(
104106
Jz=Alias(zscale, name="zscale"),
105107
JZ=Alias(zsize, name="zsize"),
108+
L=Alias(map_scale, name="map_scale"), # Deprecated.
106109
).add_common(
107110
B=frame,
108111
J=projection,

pygmt/src/coast.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
@fmt_docstring
18-
@use_alias(A="area_thresh", C="lakes", E="dcw", L="map_scale")
18+
@use_alias(A="area_thresh", C="lakes", E="dcw")
1919
def coast( # noqa: PLR0913
2020
self,
2121
resolution: Literal[
@@ -26,6 +26,7 @@ def coast( # noqa: PLR0913
2626
rivers: int | str | Sequence[int | str] | None = None,
2727
borders: int | str | Sequence[int | str] | None = None,
2828
shorelines: bool | str | Sequence[int | str] = False,
29+
map_scale: str | None = None,
2930
box: Box | bool = False,
3031
projection: str | None = None,
3132
frame: str | Sequence[str] | bool = False,
@@ -131,9 +132,12 @@ def coast( # noqa: PLR0913
131132
- ``rivers=["1/0.5p,blue", "5/0.3p,cyan,dashed"]``: Draw permanent major rivers
132133
with a 0.5-point blue pen and intermittent major rivers with a 0.3-point
133134
dashed cyan pen.
134-
map_scale : str
135-
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\ **+w**\ *length*.
135+
map_scale
136136
Draw a simple map scale centered on the reference point specified.
137+
138+
.. deprecated:: v0.19.0
139+
140+
Recommended to use :meth:`pygmt.Figure.scalebar` instead.
137141
box
138142
Draw a background box behind the map scale or rose. If set to ``True``, a simple
139143
rectangular box is drawn using :gmt-term:`MAP_FRAME_PEN`. To customize the box
@@ -256,6 +260,7 @@ def coast( # noqa: PLR0913
256260
F=Alias(box, name="box"),
257261
G=Alias(land, name="land"),
258262
I=Alias(rivers, name="rivers"),
263+
L=Alias(map_scale, name="map_scale"), # Deprecated.
259264
N=Alias(borders, name="borders"),
260265
S=Alias(water, name="water"),
261266
W=Alias(shorelines, name="shorelines"),

0 commit comments

Comments
 (0)