Conversation
With a logarithmic x- or y-axis (e.g. -JX-15cl/4c), the modern-mode -Ra shorthand rounded the data-derived region with the same linear "nearest fifth of a decade" logic used for Cartesian axes, so the lower bound could land on 0 or below -- invalid on a log10 axis. The issue's example gave -R0/260/-2/86 for data spanning x = 2 to 256. gmtinit_get_region_from_data now checks whether -Jx|X requests a log10 x- and/or y-axis and, if so, expands that side out to the enclosing powers of ten. The check reads the raw -J string rather than calling gmtinit_parse_J_option: -J is not parsed for real until much later, and parsing it here would reset the column types just determined from the data and emit "? not a valid number" warnings for the unresolved ?-widths that subplot and inset panels legitimately still carry. Also fixes the rounding loop's item index, which only advanced inside the per-side branch and so was left stale by a skipped (already-rounded) side, making the remaining side write over the other side's bounds. This is what left the region above at 0/260 rather than 1/260, and it is a pre-existing bug for geographic data too: -R1/358/-55/58 rounded to 0/360/-55/58, silently dropping the latitude rounding. Only reachable when exactly one side is pre-set, so gmt_round_wesn's other caller (pscoupe, which passes geo = false) is unaffected. gmt_round_wesn keeps its signature and behavior as a thin wrapper. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The following script fails because
-Rarounds an axis bound to (or past) zero, which is invalid on a logarithmic axis:This PR fix this and a figure is created.
Assisted-by Claude Opus 5 (Medium effort)
Fixes #6614.