diff --git a/pygmt/src/basemap.py b/pygmt/src/basemap.py index 7ad52d32cb0..30927ffea78 100644 --- a/pygmt/src/basemap.py +++ b/pygmt/src/basemap.py @@ -3,7 +3,6 @@ """ from pygmt.clib import Session -from pygmt.exceptions import GMTInvalidInput from pygmt.helpers import ( args_in_kwargs, build_arg_string, @@ -43,9 +42,6 @@ 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. - Full option list at :gmt-docs:`basemap.html` {aliases} @@ -96,8 +92,6 @@ def basemap(self, **kwargs): """ kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access if not args_in_kwargs(args=["B", "L", "Td", "Tm", "c"], kwargs=kwargs): - raise GMTInvalidInput( - "At least one of frame, map_scale, compass, rose, or panel must be specified." - ) + kwargs["B"] = True # Plotting frames if required arguments not given with Session() as lib: lib.call_module("basemap", 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 new file mode 100644 index 00000000000..1361a4b0138 --- /dev/null +++ b/pygmt/tests/baseline/test_basemap_required_args.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 36f8200a27d23e19951c2a3823a28faa + size: 6163 + path: test_basemap_required_args.png diff --git a/pygmt/tests/test_basemap.py b/pygmt/tests/test_basemap.py index 7c05e84973a..66804889a50 100644 --- a/pygmt/tests/test_basemap.py +++ b/pygmt/tests/test_basemap.py @@ -3,16 +3,16 @@ """ import pytest from pygmt import Figure -from pygmt.exceptions import GMTInvalidInput +@pytest.mark.mpl_image_compare def test_basemap_required_args(): """ - Figure.basemap fails when not given required arguments. + Automatically set `frame=True` when required arguments are not given. """ fig = Figure() - with pytest.raises(GMTInvalidInput): - fig.basemap(region=[10, 70, -3, 8], projection="X8c/6c") + fig.basemap(region=[10, 70, -3, 8], projection="X8c/6c") + return fig @pytest.mark.mpl_image_compare