|
| 1 | +""" |
| 2 | +directional_rose - Add a map directional rose. |
| 3 | +""" |
| 4 | + |
| 5 | +from collections.abc import Sequence |
| 6 | +from typing import Literal |
| 7 | + |
| 8 | +from pygmt._typing import AnchorCode |
| 9 | +from pygmt.alias import Alias, AliasSystem |
| 10 | +from pygmt.clib import Session |
| 11 | +from pygmt.helpers import build_arg_list |
| 12 | + |
| 13 | + |
| 14 | +def directional_rose( |
| 15 | + self, |
| 16 | + position, |
| 17 | + position_type: Literal["user", "justify", "mirror", "normalize", "plot"] |
| 18 | + | None = None, |
| 19 | + width=None, |
| 20 | + fancy: Literal[1, 2, 3] | bool = False, |
| 21 | + justify: AnchorCode | None = None, |
| 22 | + offset: Sequence[float | str] | None = None, |
| 23 | + label: Sequence[str] | bool = False, |
| 24 | +): |
| 25 | + """ |
| 26 | + Add a directional rose to the map. |
| 27 | +
|
| 28 | + Parameters |
| 29 | + ---------- |
| 30 | + TODO |
| 31 | +
|
| 32 | + Examples |
| 33 | + -------- |
| 34 | + >>> import pygmt |
| 35 | + >>> fig = pygmt.Figure() |
| 36 | + >>> fig.basemap(region=[0, 80, -30, 30], projection="M10c", frame=True) |
| 37 | + >>> fig.directional_rose(position=(10, 10), position_type="user") |
| 38 | + >>> fig.show() |
| 39 | + """ |
| 40 | + self._activate_figure() |
| 41 | + |
| 42 | + aliasdict = AliasSystem( |
| 43 | + Td=[ |
| 44 | + Alias( |
| 45 | + position_type, |
| 46 | + name="position_type", |
| 47 | + mapping={ |
| 48 | + "user": "g", |
| 49 | + "justify": "j", |
| 50 | + "mirror": "J", |
| 51 | + "normalize": "n", |
| 52 | + "plot": "x", |
| 53 | + }, |
| 54 | + ), |
| 55 | + Alias(position, name="position", separator="/"), |
| 56 | + Alias(width, name="width", prefix="+w"), |
| 57 | + Alias(fancy, name="fancy", prefix="+f"), |
| 58 | + Alias(justify, name="justify", prefix="+j"), |
| 59 | + Alias(label, name="label", prefix="+l", separator=",", size=4), |
| 60 | + Alias(offset, name="offset", prefix="+o", separator="/", size=[1, 2]), |
| 61 | + ] |
| 62 | + ) |
| 63 | + |
| 64 | + with Session() as lib: |
| 65 | + lib.call_module(module="basemap", args=build_arg_list(aliasdict)) |
0 commit comments