From 4d6583881728c83e755401c2e5a95f66e97722da Mon Sep 17 00:00:00 2001 From: Joaquim Date: Sat, 7 Feb 2026 18:07:42 +0000 Subject: [PATCH] Revert commit derived from 8875 because it broke other cases. --- src/subplot.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/subplot.c b/src/subplot.c index 563ef9ef545..a12e7d400f6 100644 --- a/src/subplot.c +++ b/src/subplot.c @@ -771,6 +771,42 @@ static int parse (struct GMT_CTRL *GMT, struct SUBPLOT_CTRL *Ctrl, struct GMT_OP if (c) c[0] = '+'; /* Restore modifiers */ } } + if (!Bframe) { /* No override, examine the default frame setting instead */ + gmt_set_undefined_axes (GMT, true); /* We cannot have MAP_FRAME_AXES=auto in subplot during -B parsing, so do the update now */ + if (Ctrl->S[GMT_X].active) /* Automatic selection of row sides via -Sr, so set to SN */ + strcpy (Ctrl->S[GMT_X].axes, "SN"); + else { /* Extract what the MAP_FRAME_AXES has for this axis instead */ + if (strchr (GMT->current.setting.map_frame_axes, 'S')) Ctrl->S[GMT_X].axes[px++] = 'S'; + else if (strchr (GMT->current.setting.map_frame_axes, 's')) Ctrl->S[GMT_X].axes[px++] = 's'; + else if (strchr (GMT->current.setting.map_frame_axes, 'b')) Ctrl->S[GMT_X].axes[px++] = 'b'; + if (strchr (GMT->current.setting.map_frame_axes, 'N')) Ctrl->S[GMT_X].axes[px++] = 'N'; + else if (strchr (GMT->current.setting.map_frame_axes, 'n')) Ctrl->S[GMT_X].axes[px++] = 'n'; + else if (strchr (GMT->current.setting.map_frame_axes, 't')) Ctrl->S[GMT_X].axes[px++] = 't'; + } + if (Ctrl->S[GMT_Y].active) /* Automatic selection of column sides via -Sc, so set to WE */ + strcpy (Ctrl->S[GMT_Y].axes, "WE"); + else { /* Extract what the MAP_FRAME_AXES has for this axis instead */ + if (strchr (GMT->current.setting.map_frame_axes, 'W')) Ctrl->S[GMT_Y].axes[py++] = 'W'; + else if (strchr (GMT->current.setting.map_frame_axes, 'w')) Ctrl->S[GMT_Y].axes[py++] = 'w'; + else if (strchr (GMT->current.setting.map_frame_axes, 'l')) Ctrl->S[GMT_Y].axes[py++] = 'l'; + if (strchr (GMT->current.setting.map_frame_axes, 'E')) Ctrl->S[GMT_Y].axes[py++] = 'E'; + else if (strchr (GMT->current.setting.map_frame_axes, 'e')) Ctrl->S[GMT_Y].axes[py++] = 'e'; + else if (strchr (GMT->current.setting.map_frame_axes, 'r')) Ctrl->S[GMT_Y].axes[py++] = 'r'; + } + /* Update MAP_FRAME_AXES for this subplot settings */ + if (!strcmp (GMT->current.setting.map_frame_axes, "auto")) { + char axes[GMT_LEN32] = {""}; + strcpy (axes, Ctrl->S[GMT_X].axes); + strcat (axes, Ctrl->S[GMT_Y].axes); + strcat (axes, "Z"); + gmtlib_setparameter (GMT, "MAP_FRAME_AXES", axes, true); + } + } +#if 0 + /* This code block is left here to show the attempt in + "Correctly setting the WrbNZ configuration. (#8875)" + The problem was that it fixed one case but broke others (failing tests, see #8884) + */ if (!Bframe) { /* No override, examine the default frame setting instead */ bool is_polar_or_azim = false; gmt_set_undefined_axes (GMT, true); /* Don't set MAP_FRAME_AXES=auto in subplot during -B parsing */ @@ -806,6 +842,7 @@ static int parse (struct GMT_CTRL *GMT, struct SUBPLOT_CTRL *Ctrl, struct GMT_OP } } } +#endif if (Ctrl->S[GMT_X].b == NULL) Ctrl->S[GMT_X].b = strdup ("af"); /* Default is -Baf if not set */ if (Ctrl->S[GMT_Y].b == NULL) Ctrl->S[GMT_Y].b = strdup ("af"); n_errors += gmt_M_check_condition (GMT, Ctrl->A.mode == SUBPLOT_LABEL_IS_LETTER && Ctrl->A.roman, "Option -A: Cannot select Roman numerals AND letters!\n");