diff --git a/pygmt/src/subplot.py b/pygmt/src/subplot.py index b6f6a98eda9..f91b15300f9 100644 --- a/pygmt/src/subplot.py +++ b/pygmt/src/subplot.py @@ -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: @@ -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 diff --git a/pygmt/tests/test_subplot.py b/pygmt/tests/test_subplot.py index c6d7010238a..8a6d5ae10f7 100644 --- a/pygmt/tests/test_subplot.py +++ b/pygmt/tests/test_subplot.py @@ -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])