Skip to content

Commit

Permalink
Fix bug that prevented boolean to -A from working
Browse files Browse the repository at this point in the history
  • Loading branch information
weiji14 committed Feb 12, 2021
1 parent d3c0a50 commit eadb847
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pygmt/src/subplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def subplot(self, nrows=1, ncols=1, **kwargs):
{XY}
"""
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
kwargs["A"] = f'"{kwargs.get("A")}"' if kwargs.get("A") else None
# allow for spaces in string with needing double quotes
kwargs["A"] = f'"{kwargs.get("A")}"' if kwargs.get("A") is not None else None
kwargs["T"] = f'"{kwargs.get("T")}"' if kwargs.get("T") else None

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

Expand Down
4 changes: 2 additions & 2 deletions pygmt/tests/test_subplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ def test_subplot_autolabel_margins_title():
fig_ref, fig_test = Figure(), Figure()
kwargs = dict(nrows=2, ncols=1, figsize=("15c", "6c"))

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

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

0 comments on commit eadb847

Please sign in to comment.