Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 32 additions & 28 deletions src/subplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,34 +772,38 @@ static int parse (struct GMT_CTRL *GMT, struct SUBPLOT_CTRL *Ctrl, struct GMT_OP
}
}
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);
bool is_polar_or_azim = false;
gmt_set_undefined_axes (GMT, true); /* Don't set MAP_FRAME_AXES=auto in subplot during -B parsing */
if (GMT->current.proj.projection == GMT_POLAR || (gmt_M_is_azimuthal (GMT) && doubleAlmostEqual (GMT->current.proj.pars[1], -90.0))) is_polar_or_azim = true;
if (!is_polar_or_azim) { /* Only override axes for non-polar/non-azimuthal projections */
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 (Ctrl->S[GMT_X].b == NULL) Ctrl->S[GMT_X].b = strdup ("af"); /* Default is -Baf if not set */
Expand Down
8 changes: 8 additions & 0 deletions test/psbasemap/subplot_south_pole.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# Test South Pole longitude annotations in subplots
gmt begin subplot_south_pole ps
gmt subplot begin 1x2 -Fs10c -BWSNE -Ba30f30g30 -M15p -X1.5c
gmt basemap -R-180/180/60/90 -JS0/90/? -c -B+t"North"
gmt basemap -R-180/180/-90/-60 -JS0/-90/? -c -B+t"South"
gmt subplot end
gmt end show
Loading