Skip to content

Commit 8cef180

Browse files
authored
Merge branch 'main' into feature/magnetic_rose
2 parents f662738 + b024edd commit 8cef180

File tree

2 files changed

+37
-22
lines changed

2 files changed

+37
-22
lines changed

pygmt/src/basemap.py

Lines changed: 24 additions & 18 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,17 @@ 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 provide higher-level interfaces to the GMT's
41+
``basemap`` module:
42+
43+
- :meth:`pygmt.Figure.scalebar`: Add a scale bar on the plot.
4544
4645
Full GMT docs at :gmt-docs:`basemap.html`.
4746
@@ -50,6 +49,7 @@ def basemap(
5049
- J = projection
5150
- Jz = zscale
5251
- JZ = zsize
52+
- L = map_scale
5353
- R = region
5454
- V = verbose
5555
- c = panel
@@ -64,10 +64,15 @@ def basemap(
6464
$region
6565
*Required if this is the first plot command.*
6666
$frame
67-
map_scale : str
68-
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\
69-
**+w**\ *length*.
70-
Draw a simple map scale centered on the reference point specified.
67+
map_scale
68+
Draw a map scale bar on the plot.
69+
70+
.. deprecated:: v0.19.0
71+
72+
This parameter is deprecated. Use :meth:`pygmt.Figure.scalebar` instead,
73+
which provides a more comprehensive and flexible API for adding scale bars
74+
to plots. This parameter still accepts raw GMT CLI strings for the ``-L``
75+
option of the ``basemap`` module for backward compatibility.
7176
box : bool or str
7277
[**+c**\ *clearances*][**+g**\ *fill*][**+i**\ [[*gap*/]\ *pen*]]\
7378
[**+p**\ [*pen*]][**+r**\ [*radius*]][**+s**\ [[*dx*/*dy*/][*shade*]]].
@@ -103,6 +108,7 @@ def basemap(
103108
aliasdict = AliasSystem(
104109
Jz=Alias(zscale, name="zscale"),
105110
JZ=Alias(zsize, name="zsize"),
111+
L=Alias(map_scale, name="map_scale"), # Deprecated.
106112
).add_common(
107113
B=frame,
108114
J=projection,

pygmt/src/coast.py

Lines changed: 13 additions & 4 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,
@@ -63,6 +64,7 @@ def coast( # noqa: PLR0913
6364
- G = land
6465
- I = rivers
6566
- J = projection
67+
- L = map_scale
6668
- R = region
6769
- S = water
6870
- V = verbose
@@ -131,9 +133,15 @@ def coast( # noqa: PLR0913
131133
- ``rivers=["1/0.5p,blue", "5/0.3p,cyan,dashed"]``: Draw permanent major rivers
132134
with a 0.5-point blue pen and intermittent major rivers with a 0.3-point
133135
dashed cyan pen.
134-
map_scale : str
135-
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\ **+w**\ *length*.
136-
Draw a simple map scale centered on the reference point specified.
136+
map_scale
137+
Draw a map scale bar on the plot.
138+
139+
.. deprecated:: v0.19.0
140+
141+
This parameter is deprecated. Use :meth:`pygmt.Figure.scalebar` instead,
142+
which provides a more comprehensive and flexible API for adding scale bars
143+
to plots. This parameter still accepts raw GMT CLI strings for the ``-L``
144+
option of the ``basemap`` module for backward compatibility.
137145
box
138146
Draw a background box behind the map scale or rose. If set to ``True``, a simple
139147
rectangular box is drawn using :gmt-term:`MAP_FRAME_PEN`. To customize the box
@@ -256,6 +264,7 @@ def coast( # noqa: PLR0913
256264
F=Alias(box, name="box"),
257265
G=Alias(land, name="land"),
258266
I=Alias(rivers, name="rivers"),
267+
L=Alias(map_scale, name="map_scale"), # Deprecated.
259268
N=Alias(borders, name="borders"),
260269
S=Alias(water, name="water"),
261270
W=Alias(shorelines, name="shorelines"),

0 commit comments

Comments
 (0)