From 3809729ddc0a5b5e74d28823730bc06e74f7b7b9 Mon Sep 17 00:00:00 2001 From: Joaquim Date: Thu, 23 Apr 2026 00:09:23 +0100 Subject: [PATCH 1/2] psbasemap: fix -Ba -Bz on classic Fix #8845 Assisted-by: Claude Sonnet 4.6 --- src/gmt_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gmt_init.c b/src/gmt_init.c index 9300cb99626..73b12483c29 100644 --- a/src/gmt_init.c +++ b/src/gmt_init.c @@ -4701,7 +4701,7 @@ bool gmtlib_B_is_frame (struct GMT_CTRL *GMT, char *in) { if (strstr (in, "+u")) return false; /* Found a +u so likely axis */ if (in[0] != 'z' && strchr ("WESNZwenzlrbtu", in[0])) return true; /* Found one of the side specifiers so likely frame (check on z since -Bzaf could trick it) */ if (in[0] == 's' && (in[1] == 0 || strchr ("WESNZwenzlrbtu", in[1]) != NULL)) return true; /* Found -Bs (just draw south axis) or -Bs */ - if (in[0] == 'z' && (in[1] == 0 || strchr ("WESNwenlrbtu", in[1]) != NULL)) return true; /* Found -Bz in frame context, e.g. -Bzwn */ + if (in[0] == 'z' && in[1] != 0 && strchr ("WESNwenlrbtu", in[1]) != NULL) return true; /* Found -Bz in frame context, e.g. -Bzwn (bare -Bz is axis context) */ return false; /* Cannot be frame */ } @@ -18626,7 +18626,7 @@ int gmt_parse_common_options (struct GMT_CTRL *GMT, char *list, char option, cha default: GMT->common.B.active[GMT_PRIMARY] = true; break; } if (!error) { - if (GMT->current.setting.run_mode == GMT_MODERN && (!GMT->current.map.frame.set[GMT_X] || !GMT->current.map.frame.set[GMT_Y] || (GMT->common.J.zactive && !GMT->current.map.frame.set[GMT_Z]))) { + if (!GMT->current.map.frame.set[GMT_X] || !GMT->current.map.frame.set[GMT_Y] || (GMT->common.J.zactive && !GMT->current.map.frame.set[GMT_Z])) { char code[2], args[GMT_LEN256] = {""}, *c = strchr (item, '+'); /* Start of modifiers, if any */ if (item[q] && strstr (item, "+f")) GMT->current.plot.calclock.geo.wesn = 1; /* Got +f, so enable W|E|S|N suffixes */ if (c && strchr (GMT_AXIS_MODIFIERS, c[1])) /* We got the ones suitable for axes that we can chop off */ From b5850d6747644684a23c470f0c395a1ea30b3abb Mon Sep 17 00:00:00 2001 From: Joaquim Date: Thu, 23 Apr 2026 21:16:14 +0100 Subject: [PATCH 2/2] Better fix that does not break some classic mode tests. --- src/gmt_init.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gmt_init.c b/src/gmt_init.c index 73b12483c29..bddce895cb9 100644 --- a/src/gmt_init.c +++ b/src/gmt_init.c @@ -18626,7 +18626,7 @@ int gmt_parse_common_options (struct GMT_CTRL *GMT, char *list, char option, cha default: GMT->common.B.active[GMT_PRIMARY] = true; break; } if (!error) { - if (!GMT->current.map.frame.set[GMT_X] || !GMT->current.map.frame.set[GMT_Y] || (GMT->common.J.zactive && !GMT->current.map.frame.set[GMT_Z])) { + if (GMT->current.setting.run_mode == GMT_MODERN && (!GMT->current.map.frame.set[GMT_X] || !GMT->current.map.frame.set[GMT_Y] || (GMT->common.J.zactive && !GMT->current.map.frame.set[GMT_Z]))) { char code[2], args[GMT_LEN256] = {""}, *c = strchr (item, '+'); /* Start of modifiers, if any */ if (item[q] && strstr (item, "+f")) GMT->current.plot.calclock.geo.wesn = 1; /* Got +f, so enable W|E|S|N suffixes */ if (c && strchr (GMT_AXIS_MODIFIERS, c[1])) /* We got the ones suitable for axes that we can chop off */ @@ -18649,6 +18649,13 @@ int gmt_parse_common_options (struct GMT_CTRL *GMT, char *list, char option, cha strncpy (args, item, GMT_LEN256-1); error = gmtlib_parse_B_option (GMT, args); } + else if (GMT->common.J.zactive && !GMT->current.map.frame.set[GMT_Z] && item[q] == 'z' && item[q+1] == '\0') { + /* Classic mode: expand bare -Bz to -Bzaf when z-axis is active but has no annotation settings yet */ + char args[GMT_LEN256] = {""}; + if (q) args[0] = item[0]; + strcat(args, "zaf"); + error = gmtlib_parse_B_option(GMT, args); + } else error = gmtlib_parse_B_option (GMT, item); }