Skip to content

Fix #8993 "-Ba5f1g1+0.5, grid offset affects grid, minor and major/annotated tick positions" - #9159

Merged
joa-quim merged 2 commits into
masterfrom
issue-8993
Aug 27, 2026
Merged

Fix #8993 "-Ba5f1g1+0.5, grid offset affects grid, minor and major/annotated tick positions"#9159
joa-quim merged 2 commits into
masterfrom
issue-8993

Conversation

@joa-quim

Copy link
Copy Markdown
Member

Example in issue page now works fine and no secondary failures were detected.

gmt basemap -R0/10/0/10 -Ba5f1g1+0.5 -JX5c -png all_ticks_offset

Fix #8993

Assisted by GPT Terra, revised by Claude Opus 5.0

joa-quim and others added 2 commits August 25, 2026 20:00
-B intervals are documented as a string of [a|f|g][stride][phase][unit]
substrings, and gmtinit_decode_tinfo does parse each substring on its own.  But
gmtinit_set_titem then stored the phase on the axis, "phase must apply to
entire axis", and every consumer read it from there.  A phase written on g was
therefore applied to the annotations, both tick series, the fancy-frame
checkers and the annotation format as well, so -Ba5f1g1+0.5 shifted the whole
frame and the documented result needed two basemap calls.

phase moves from GMT_PLOT_AXIS into GMT_PLOT_AXIS_ITEM, so each of the eight
items carries its own, and the layout code is handed the phase of the item it
is drawing: gmtlib_coordinate_array uses T->phase, gmtlib_pow_array and the
gridline drawers take it as an argument (gmt_linearx_grid is public and also
called from psscale, which passes item[GMT_GRID_UPPER].phase), the checkers use
the tick item they already have, and the decimal-count logic in gmt_xy_axis
consults item[GMT_ANNOT_UPPER].phase since only an annotation phase can add
digits.  GMT_PLOT_AXIS.phase is deleted rather than left in place, so the
compiler pointed at every site that used to read it.

This changes behavior: a script relying on the axis-wide shift restores its
plot by repeating the phase, -Ba5+0.5f1+0.5g1+0.5 for -Ba5f1g1+0.5.  The two
tests that relied on the old reading, psxy/units.sh and pscoast/pscoast_180.sh,
are updated that way so their baselines still match.

test/psbasemap/axis_phase.sh compares the single-call frame with the two-call
sequence, so it needs no PostScript baseline.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@joa-quim joa-quim added the AI-assisted All (or most) of the code was written by Artificial Intelligence. label Aug 27, 2026
@joa-quim
joa-quim requested a review from a team August 27, 2026 17:53
@Esteban82

Copy link
Copy Markdown
Member

It works. I got this figure.

all_ticks_offset

@Esteban82 Esteban82 added the add-changelog Add PR to the changelog label Aug 27, 2026
@Esteban82 Esteban82 added this to the 6.8.0 milestone Aug 27, 2026
@joa-quim
joa-quim merged commit c51196b into master Aug 27, 2026
11 of 14 checks passed
@joa-quim
joa-quim deleted the issue-8993 branch August 27, 2026 18:34
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.

-Ba5f1g1+0.5, grid offset affects grid, minor and major/annotated tick positions

2 participants