|
| 1 | +""" |
| 2 | +scalebar - Add a scale bar. |
| 3 | +""" |
| 4 | + |
| 5 | +from pygmt.alias import Alias, AliasSystem |
| 6 | +from pygmt.clib import Session |
| 7 | +from pygmt.helpers import build_arg_list |
| 8 | + |
| 9 | + |
| 10 | +# ruff: noqa: ARG001 |
| 11 | +def scalebar( # noqa: PLR0913 |
| 12 | + self, |
| 13 | + position, |
| 14 | + length, |
| 15 | + label_alignment=None, |
| 16 | + scale_position=None, |
| 17 | + fancy=None, |
| 18 | + justify=None, |
| 19 | + label=None, |
| 20 | + offset=None, |
| 21 | + unit=None, |
| 22 | + vertical=None, |
| 23 | + box=None, |
| 24 | +): |
| 25 | + """ |
| 26 | + Add a scale bar. |
| 27 | +
|
| 28 | + Parameters |
| 29 | + ---------- |
| 30 | + TODO |
| 31 | +
|
| 32 | + Examples |
| 33 | + -------- |
| 34 | + >>> import pygmt |
| 35 | + >>> from pygmt.params import Box |
| 36 | + >>> fig = pygmt.Figure() |
| 37 | + >>> fig.basemap(region=[0, 80, -30, 30], projection="M10c", frame=True) |
| 38 | + >>> fig.scalebar( |
| 39 | + ... "g10/10", |
| 40 | + ... length=1000, |
| 41 | + ... fancy=True, |
| 42 | + ... label="Scale", |
| 43 | + ... unit=True, |
| 44 | + ... box=Box(pen=0.5, fill="lightblue"), |
| 45 | + ... ) |
| 46 | + >>> fig.show() |
| 47 | + """ |
| 48 | + alias = AliasSystem( |
| 49 | + L=[ |
| 50 | + Alias("position", separator="/"), |
| 51 | + Alias("length", prefix="+w"), |
| 52 | + Alias("label_alignment", prefix="+a"), |
| 53 | + Alias("scale_position", prefix="+c", separator="/"), |
| 54 | + Alias("fancy", prefix="+f"), |
| 55 | + Alias("justify", prefix="+j"), |
| 56 | + Alias("label", prefix="+l"), |
| 57 | + Alias("offset", prefix="+o", separator="/"), |
| 58 | + Alias("unit", prefix="+u"), |
| 59 | + Alias("vertical", prefix="+v"), |
| 60 | + ], |
| 61 | + F="box", |
| 62 | + ) |
| 63 | + |
| 64 | + self._preprocess() |
| 65 | + with Session() as lib: |
| 66 | + lib.call_module(module="basemap", args=build_arg_list(alias.kwdict)) |
0 commit comments