Skip to content

Commit

Permalink
Alias frame (B) for subplot
Browse files Browse the repository at this point in the history
Include test to check that map frame setting is applied to all subplot figures when using 'begin' subplot directive.
  • Loading branch information
weiji14 committed Sep 20, 2020
1 parent a74cacf commit 78efa6c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pygmt/base_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwarg
lib.call_module("legend", arg_str)

@fmt_docstring
@use_alias(F="dimensions")
@use_alias(F="dimensions", B="frame")
def subplot(self, directive: str, row: int = None, col: int = None, **kwargs):
"""
Manage modern mode figure subplot configuration and selection.
Expand Down
Binary file added pygmt/tests/baseline/test_subplot_frame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions pygmt/tests/test_subplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ def test_subplot_basic():
return fig


@pytest.mark.mpl_image_compare
def test_subplot_frame():
"""
Check that map frame setting is applied to all subplot figures
"""
fig = Figure()
fig.subplot(directive="begin", row=1, col=2, dimensions="f6c/3c", frame="WSne")
fig.subplot(directive="set", row=0, col=0)
fig.basemap(region=[0, 3, 0, 3], frame="+tplot0")
fig.subplot(directive="set", row=0, col=1)
fig.basemap(region=[0, 3, 0, 3], frame="+tplot1")
fig.subplot(directive="end")
return fig


def test_subplot_incorrect_directive():
"""
Check that subplot fails when an incorrect directive is used
Expand Down

0 comments on commit 78efa6c

Please sign in to comment.