-
Notifications
You must be signed in to change notification settings - Fork 228
Fix setting "sharex", "sharey", and "frame" of Figure.subplot in combination with Figure.basemap #2417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/format |
Based on this rough test I feel setting the Code example import pygmt
nrows = 1
ncols = 2
fig = pygmt.Figure()
with fig.subplot(
nrows=nrows,
ncols=ncols,
figsize=("10c", "5c"),
sharex="b+llabel_x", # at the bottom
sharey="l+llabel_y", # on the left side
# annotations in steps of 5
# ticks in steps of 0.5
# gridlines in steps of 1
frame="a5f0.5g1",
):
for i in range(nrows):
for j in range(ncols):
index = i * nrows + j
with fig.set_panel(panel=index):
fig.basemap(region=[0, 10, 0, 10], projection="X?")
fig.show()
# fig.savefig(fname="issue_labels_doubleloop_NEW.png") |
Summary of changed imagesThis is an auto-generated report of images that have changed on the DVC remote
Image diff(s)Report last updated at commit e1ffbdb |
Co-authored-by: Dongdong Tian <[email protected]>
pygmt/src/basemap.py
Outdated
if not args_in_kwargs(args=["B", "L", "Td", "Tm", "c"], kwargs=kwargs): | ||
kwargs["B"] = True # Plotting frames if required arguments not given | ||
raise GMTInvalidInput( | ||
"At least one of 'frame', 'map_scale', 'compass', 'rose', or 'panel' must be specified." | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, in subplot mode, none of these options are required. For example, the first example in #2365 no longer works after this PR.
Ideally, we should check if it's in subplot mode, and these options are required only when it's NOT in subplot mode. However, currently we can't know it. So I believe we have to remove the checks, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in commit 8e9d4e5.
Co-authored-by: Dongdong Tian <[email protected]>
/format |
Co-authored-by: Dongdong Tian <[email protected]>
Description of proposed changes
For context please see issue #2365
This PR aims to test the suggestion in comment #2365 (comment).
First PR #2418 has to be merged.
Fixes #2365
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version