Skip to content

Commit 3e77f76

Browse files
committed
Use new values for position_type
1 parent 7afcfaf commit 3e77f76

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

pygmt/src/scalebar.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ def scalebar( # noqa: PLR0913
1515
self,
1616
position,
1717
length,
18-
position_type: Literal["user", "justify", "mirror", "normalize", "plot"]
19-
| None = None,
18+
position_type: Literal[
19+
"mapcoords", "inside", "outside", "boxcoords", "plotcoords"
20+
] = "mapcoords",
2021
label_alignment: Literal["left", "right", "top", "bottom"] | None = None,
2122
scale_position=None,
2223
justify: AnchorCode | None = None,
@@ -30,6 +31,24 @@ def scalebar( # noqa: PLR0913
3031
"""
3132
Add a scale bar.
3233
34+
Parameters
35+
----------
36+
position/position_type
37+
Location of the rose. The actual meaning of this parameter depends on the
38+
``position_type`` parameter.
39+
- ``position_type="mapcoords"``: *position* is given as (x, y) in user
40+
coordinates.
41+
- ``position_type="boxcoords"``: *position* is given as (nx, ny) in normalized
42+
coordinates, where (0, 0) is the lower-left corner and (1, 1) is the
43+
upper-right corner of the map.
44+
- ``position_type="plotcoords"``: *position* is given as (x, y) in plot
45+
coordinates.
46+
- ``position_type="inside"``: *position* is given as a two-character
47+
justification code, meaning the anchor point of the rose is inside the map
48+
bounding box.
49+
- ``position_type="outside"``: *position* is given as a two-character
50+
justification code, but the rose is outside the map bounding box.
51+
3352
Parameters
3453
----------
3554
TODO
@@ -58,14 +77,14 @@ def scalebar( # noqa: PLR0913
5877
position_type,
5978
name="position_type",
6079
mapping={
61-
"user": "g",
62-
"justify": "j",
63-
"mirror": "J",
64-
"normalize": "n",
65-
"plot": "x",
80+
"mapcoords": "g",
81+
"inside": "j",
82+
"outside": "J",
83+
"boxcoords": "n",
84+
"plotcoords": "x",
6685
},
6786
),
68-
Alias(position, name="position", separator="/"),
87+
Alias(position, name="position", separator="/", size=2),
6988
Alias(length, name="length", prefix="+w"),
7089
Alias(
7190
label_alignment,

0 commit comments

Comments
 (0)