diff --git a/pygmt/base_plotting.py b/pygmt/base_plotting.py index 5b1f4076aec..45f0cc6ef35 100644 --- a/pygmt/base_plotting.py +++ b/pygmt/base_plotting.py @@ -1167,8 +1167,10 @@ def basemap(self, **kwargs): """ kwargs = self._preprocess(**kwargs) - if not ("B" in kwargs or "L" in kwargs or "T" in kwargs): - raise GMTInvalidInput("At least one of B, L, or T must be specified.") + if not ("B" in kwargs or "L" in kwargs or "Td" in kwargs or "Tm" in kwargs): + raise GMTInvalidInput( + "At least one of frame, map_scale, compass, or rose must be specified." + ) with Session() as lib: lib.call_module("basemap", build_arg_string(kwargs)) diff --git a/pygmt/tests/test_basemap.py b/pygmt/tests/test_basemap.py index bc0d43059b1..db7db2bc265 100644 --- a/pygmt/tests/test_basemap.py +++ b/pygmt/tests/test_basemap.py @@ -80,3 +80,25 @@ def test_basemap_aliases(): fig = Figure() fig.basemap(region=[0, 360, -90, 90], projection="W7i", frame=True) return fig + + +@check_figures_equal() +def test_basemap_rose(): + "Create a map with coast and use basemap to add a rose" + fig_ref, fig_test = Figure(), Figure() + fig_ref.coast(R="127.5/128.5/26/27", W="1/0.5p") + fig_ref.basemap(Td="jBR+w5c") + fig_test.coast(region=[127.5, 128.5, 26, 27], shorelines="1/0.5p") + fig_test.basemap(rose="jBR+w5c") + return fig_ref, fig_test + + +@check_figures_equal() +def test_basemap_compass(): + "Create a map with coast and use basemap to add a compass" + fig_ref, fig_test = Figure(), Figure() + fig_ref.coast(R="127.5/128.5/26/27", W="1/0.5p") + fig_ref.basemap(Tm="jBR+w5c+d11.5") + fig_test.coast(region=[127.5, 128.5, 26, 27], shorelines="1/0.5p") + fig_test.basemap(compass="jBR+w5c+d11.5") + return fig_ref, fig_test