Skip to content

Commit eadb847

Browse files
committed
Fix bug that prevented boolean to -A from working
1 parent d3c0a50 commit eadb847

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pygmt/src/subplot.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ def subplot(self, nrows=1, ncols=1, **kwargs):
142142
{XY}
143143
"""
144144
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
145-
kwargs["A"] = f'"{kwargs.get("A")}"' if kwargs.get("A") else None
145+
# allow for spaces in string with needing double quotes
146+
kwargs["A"] = f'"{kwargs.get("A")}"' if kwargs.get("A") is not None else None
146147
kwargs["T"] = f'"{kwargs.get("T")}"' if kwargs.get("T") else None
147148

148149
with Session() as lib:
@@ -205,7 +206,8 @@ def set_panel(self, panel=None, **kwargs):
205206
{V}
206207
"""
207208
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
208-
kwargs["A"] = f'"{kwargs.get("A")}"' if kwargs.get("A") else None
209+
# allow for spaces in string with needing double quotes
210+
kwargs["A"] = f'"{kwargs.get("A")}"' if kwargs.get("A") is not None else None
209211
# convert tuple or list to comma-separated str
210212
panel = ",".join(map(str, panel)) if is_nonstr_iter(panel) else panel
211213

pygmt/tests/test_subplot.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ def test_subplot_autolabel_margins_title():
4848
fig_ref, fig_test = Figure(), Figure()
4949
kwargs = dict(nrows=2, ncols=1, figsize=("15c", "6c"))
5050

51-
with fig_ref.subplot(A="(1)", M="0.3c/0.1c", T="Subplot Title", **kwargs):
51+
with fig_ref.subplot(A="a)", M="0.3c/0.1c", T="Subplot Title", **kwargs):
5252
fig_ref.basemap(region=[0, 1, 2, 3], frame="WSne", c="0,0")
5353
fig_ref.basemap(region=[4, 5, 6, 7], frame="WSne", c="1,0")
5454

5555
with fig_test.subplot(
56-
autolabel="(1)", margins=["0.3c", "0.1c"], title="Subplot Title", **kwargs
56+
autolabel=True, margins=["0.3c", "0.1c"], title="Subplot Title", **kwargs
5757
):
5858
fig_test.basemap(region=[0, 1, 2, 3], frame="WSne", panel=[0, 0])
5959
fig_test.basemap(region=[4, 5, 6, 7], frame="WSne", panel=[1, 0])

0 commit comments

Comments
 (0)