Skip to content

Commit 55bef26

Browse files
committed
basemap: Plotting frames if required parameters are not given
1 parent 3a371d0 commit 55bef26

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

pygmt/src/basemap.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
from pygmt.clib import Session
6-
from pygmt.exceptions import GMTInvalidInput
76
from pygmt.helpers import (
87
args_in_kwargs,
98
build_arg_string,
@@ -43,9 +42,6 @@ def basemap(self, **kwargs):
4342
tick-mark intervals for boundary annotation, ticking, and [optionally]
4443
gridlines. A simple map scale or directional rose may also be plotted.
4544
46-
At least one of the parameters ``frame``, ``map_scale``, ``rose`` or
47-
``compass`` must be specified.
48-
4945
Full option list at :gmt-docs:`basemap.html`
5046
5147
{aliases}
@@ -96,8 +92,6 @@ def basemap(self, **kwargs):
9692
"""
9793
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
9894
if not args_in_kwargs(args=["B", "L", "Td", "Tm", "c"], kwargs=kwargs):
99-
raise GMTInvalidInput(
100-
"At least one of frame, map_scale, compass, rose, or panel must be specified."
101-
)
95+
kwargs["B"] = True # Plotting frames if required arguments not given
10296
with Session() as lib:
10397
lib.call_module("basemap", build_arg_string(kwargs))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: 36f8200a27d23e19951c2a3823a28faa
3+
size: 6163
4+
path: test_basemap_required_args.png

pygmt/tests/test_basemap.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
"""
44
import pytest
55
from pygmt import Figure
6-
from pygmt.exceptions import GMTInvalidInput
76

87

8+
@pytest.mark.mpl_image_compare
99
def test_basemap_required_args():
1010
"""
11-
Figure.basemap fails when not given required arguments.
11+
Autmatically set `frame=True` when required arguments are not given.
1212
"""
1313
fig = Figure()
14-
with pytest.raises(GMTInvalidInput):
15-
fig.basemap(region=[10, 70, -3, 8], projection="X8c/6c")
14+
fig.basemap(region=[10, 70, -3, 8], projection="X8c/6c")
15+
return fig
1616

1717

1818
@pytest.mark.mpl_image_compare

0 commit comments

Comments
 (0)