Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions pygmt/src/magnetic_rose.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,15 @@ def magnetic_rose( # noqa: PLR0913

position = _parse_position(position, default=Position("BL", cstype="inside"))

if declination_label is not None and declination is None:
raise GMTParameterError(
required="declination",
reason="Required when 'declination_label' is set.",
)
if declination_label is not None:
if declination is None:
raise GMTParameterError(
required="declination",
reason="Required when 'declination_label' is set.",
)
# Upstream issue that declination label with spaces is not properly handled.
if " " in declination_label:
declination_label = declination_label.replace(" ", "\\040")

aliasdict = AliasSystem(
F=Alias(box, name="box"),
Expand Down
4 changes: 2 additions & 2 deletions pygmt/tests/baseline/test_magnetic_rose_complete.png.dvc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
outs:
- md5: 78c53322b2514fbcd56483b793d47ebe
size: 28831
- md5: c39fb0511ea0a4b92d8d0202252d72ad
size: 28825
hash: md5
path: test_magnetic_rose_complete.png
2 changes: 1 addition & 1 deletion pygmt/tests/test_magnetic_rose.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_magnetic_rose_complete():
outer_pen="1p,red",
inner_pen="1p,blue",
declination=11.5,
declination_label="11.5°E",
declination_label="11.5 °E",
)
return fig

Expand Down
Loading