diff --git a/pygmt/src/basemap.py b/pygmt/src/basemap.py index 32f12782da0..a334ce4163a 100644 --- a/pygmt/src/basemap.py +++ b/pygmt/src/basemap.py @@ -3,13 +3,7 @@ """ from pygmt.clib import Session -from pygmt.helpers import ( - args_in_kwargs, - build_arg_string, - fmt_docstring, - kwargs_to_strings, - use_alias, -) +from pygmt.helpers import build_arg_string, fmt_docstring, kwargs_to_strings, use_alias @fmt_docstring @@ -39,6 +33,9 @@ def basemap(self, **kwargs): tick-mark intervals for boundary annotation, ticking, and [optionally] gridlines. A simple map scale or directional rose may also be plotted. + At least one of the parameters ``frame``, ``map_scale``, ``rose``, or + ``compass`` must be specified if not in subplot mode. + Full option list at :gmt-docs:`basemap.html` {aliases} @@ -86,7 +83,5 @@ def basemap(self, **kwargs): {transparency} """ kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access - if not args_in_kwargs(args=["B", "L", "Td", "Tm", "c"], kwargs=kwargs): - kwargs["B"] = True # Plotting frames if required arguments not given with Session() as lib: lib.call_module(module="basemap", args=build_arg_string(kwargs)) diff --git a/pygmt/tests/baseline/test_basemap_required_args.png.dvc b/pygmt/tests/baseline/test_basemap_required_args.png.dvc deleted file mode 100644 index 1361a4b0138..00000000000 --- a/pygmt/tests/baseline/test_basemap_required_args.png.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: 36f8200a27d23e19951c2a3823a28faa - size: 6163 - path: test_basemap_required_args.png diff --git a/pygmt/tests/baseline/test_basemap_subplot.png.dvc b/pygmt/tests/baseline/test_basemap_subplot.png.dvc new file mode 100644 index 00000000000..7456d294144 --- /dev/null +++ b/pygmt/tests/baseline/test_basemap_subplot.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 1b4ae53658eec125ebf8ab4eac78d729 + size: 8733 + path: test_basemap_subplot.png diff --git a/pygmt/tests/test_basemap.py b/pygmt/tests/test_basemap.py index 2d73f08986d..db646a04d6f 100644 --- a/pygmt/tests/test_basemap.py +++ b/pygmt/tests/test_basemap.py @@ -5,16 +5,6 @@ from pygmt import Figure -@pytest.mark.mpl_image_compare -def test_basemap_required_args(): - """ - Automatically set `frame=True` when required arguments are not given. - """ - fig = Figure() - fig.basemap(region=[10, 70, -3, 8], projection="X8c/6c") - return fig - - @pytest.mark.mpl_image_compare def test_basemap(): """ @@ -136,3 +126,18 @@ def test_basemap_map_scale(): map_scale="jMC+c26.5+w10k+f+l", ) return fig + + +@pytest.mark.mpl_image_compare +def test_basemap_subplot(): + """ + Test in subplot mode for the case that the frame parameter of basemap is + not specified. + """ + fig = Figure() + with fig.subplot(nrows=1, ncols=2, figsize=("10c", "5c")): + with fig.set_panel(panel=0): + fig.basemap(region=[0, 10, 0, 10], projection="X?") + with fig.set_panel(panel=1): + fig.basemap(region=[0, 10, 0, 10], projection="X?") + return fig