Skip to content

Commit 8aaef2f

Browse files
committed
Updates
1 parent 02a2e77 commit 8aaef2f

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

doc/api/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Plotting map elements
3131
Figure.inset
3232
Figure.legend
3333
Figure.logo
34+
Figure.scalebar
3435
Figure.solar
3536
Figure.text
3637
Figure.timestamp

pygmt/src/scalebar.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ def scalebar( # noqa: PLR0913
1616
position,
1717
length,
1818
position_type: Literal[
19-
"mapcoords", "inside", "outside", "boxcoords", "plotcoords"
19+
"mapcoords",
20+
"boxcoords",
21+
"plotcoords",
22+
"inside",
23+
"outside",
2024
] = "mapcoords",
2125
label_alignment: Literal["left", "right", "top", "bottom"] | None = None,
2226
scale_position=None,
2327
justify: AnchorCode | None = None,
24-
offset: Sequence[float | str] | None = None,
28+
anchor_offset: Sequence[float | str] | None = None,
2529
label: str | bool = False,
2630
fancy: bool = False,
2731
unit: bool = False,
@@ -34,20 +38,21 @@ def scalebar( # noqa: PLR0913
3438
Parameters
3539
----------
3640
position/position_type
37-
Location of the rose. The actual meaning of this parameter depends on the
38-
``position_type`` parameter.
41+
Location of the map scale bar. The actual meaning of this parameter depends
42+
on the ``position_type`` parameter.
3943
- ``position_type="mapcoords"``: *position* is given as (x, y) in user
4044
coordinates.
4145
- ``position_type="boxcoords"``: *position* is given as (nx, ny) in normalized
4246
coordinates, where (0, 0) is the lower-left corner and (1, 1) is the
43-
upper-right corner of the map.
47+
upper-right corner of the plot.
4448
- ``position_type="plotcoords"``: *position* is given as (x, y) in plot
45-
coordinates.
49+
coordinates, i.e., the distances in inches, centimeters, or points from the
50+
lower left plot origin.
4651
- ``position_type="inside"``: *position* is given as a two-character
47-
justification code, meaning the anchor point of the rose is inside the map
52+
justification code, meaning the anchor point of the rose is inside the plot
4853
bounding box.
4954
- ``position_type="outside"``: *position* is given as a two-character
50-
justification code, but the rose is outside the map bounding box.
55+
justification code, but the rose is outside the plot bounding box.
5156
5257
Parameters
5358
----------
@@ -78,25 +83,27 @@ def scalebar( # noqa: PLR0913
7883
name="position_type",
7984
mapping={
8085
"mapcoords": "g",
81-
"inside": "j",
82-
"outside": "J",
8386
"boxcoords": "n",
8487
"plotcoords": "x",
88+
"inside": "j",
89+
"outside": "J",
8590
},
8691
),
87-
Alias(position, name="position", separator="/", size=2),
92+
Alias(position, name="position", sep="/", size=2),
8893
Alias(length, name="length", prefix="+w"),
8994
Alias(
9095
label_alignment,
9196
name="label_alignment",
9297
prefix="+a",
9398
mapping={"left": "l", "right": "r", "top": "t", "bottom": "b"},
9499
),
95-
Alias(scale_position, name="scale_position", prefix="+c", separator="/"),
100+
Alias(scale_position, name="scale_position", prefix="+c", sep="/"),
96101
Alias(fancy, name="fancy", prefix="+f"),
97102
Alias(justify, name="justify", prefix="+j"),
98103
Alias(label, name="label", prefix="+l"),
99-
Alias(offset, name="offset", prefix="+o", separator="/", size=[1, 2]),
104+
Alias(
105+
anchor_offset, name="anchor_offset", prefix="+o", sep="/", size=[1, 2]
106+
),
100107
Alias(unit, name="unit", prefix="+u"),
101108
Alias(vertical, name="vertical", prefix="+v"),
102109
],

0 commit comments

Comments
 (0)