Skip to content

Fix subplot -F modifier bugs (+g, +w, +c, +f)#9087

Open
Esteban82 wants to merge 2 commits into
masterfrom
fix-8744_subplot_-F
Open

Fix subplot -F modifier bugs (+g, +w, +c, +f)#9087
Esteban82 wants to merge 2 commits into
masterfrom
fix-8744_subplot_-F

Conversation

@Esteban82

Copy link
Copy Markdown
Member

Fixed done with Claude Sonnet 5.

Fixes several issues in gmt subplot begin -F where combining fill, pen, clearance, and layout-fraction modifiers produced incorrect warnings or an incomplete/incorrect canvas fill.

Closes #8744.

Test with:

#!/usr/bin/env bash

# -----------------------------------------------------------------------
# BUG 1 — "+g behaves strange with +w"

gmt begin bug1_w_and_g png
  gmt subplot begin 2x2 -Ff6c+w1p,-+gyellow -R0/10/0/10
    gmt basemap -c
  gmt subplot end
gmt end

# -----------------------------------------------------------------------
# BUG 2 — "+f must be at the end of -F"

gmt begin bug2_f_ordering png
  gmt subplot begin 2x2 -Ff6c+f3,1/1,2+w1p -R0/10/0/10
    gmt basemap -c
  gmt subplot end
gmt end

# -----------------------------------------------------------------------
# BUG 3 — "+g doesn't have the same effect with and without +c"

gmt begin bug3_g_with_clearance png
  gmt subplot begin 2x2 -Ff6c+gyellow+c1c+f3,1/1,2 -R0/10/0/10
    gmt basemap -c
  gmt subplot end
gmt end

BUG 1 — "+g behaves strange with +w"

EXPECTED: solid yellow background behind all 4 panels, no visible dividing lines (pen color is "-").
BEFORE THE FIX: the internal plot call used to draw the dividing lines painted an opaque white rectangle over the whole canvas first, hiding the yellow fill completely.

bug1_w_and_g

BUG 2 — "+f must be at the end of -F"

EXPECTED: no warning, correct 3:1 / 1:2 asymmetric layout, divider lines drawn with a 1pt pen.
BEFORE THE FIX: GMT printed "2+w1 not a valid number and may not be decoded properly" and the layout fractions came out wrong, because the +f value-parser did not know where its own argument ended and swallowed the following +w1p into the height-fraction list.

bug2_f_ordering

BUG 3 — "+g doesn't have the same effect with and without +c"

EXPECTED: yellow background fill visible everywhere, including the 1cm clearance gaps between/around panels.
BEFORE THE FIX: the internal plot call used to reset the origin after applying the clearance also painted an opaque white rectangle over the canvas first, hiding the yellow fill - same root cause as Bug 1, but triggered by +c instead of +w.

bug3_g_with_clearance

@Esteban82 Esteban82 requested review from a team, joa-quim and seisman July 3, 2026 11:09
@Esteban82 Esteban82 added add-changelog Add PR to the changelog AI-assisted All (or most) of the code was written by Artificial Intelligence. labels Jul 3, 2026
@Esteban82

Copy link
Copy Markdown
Member Author

@Dengda98, could you test it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog AI-assisted All (or most) of the code was written by Artificial Intelligence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

some bugs in subplot begin -F with modifiers

1 participant