Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange warning message with subplot and -Ba+ap #8639

Open
Esteban82 opened this issue Nov 29, 2024 · 3 comments
Open

Strange warning message with subplot and -Ba+ap #8639

Esteban82 opened this issue Nov 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Esteban82
Copy link
Member

I run this a command withsubplot -B+apand I got this warning:

gmt subplot begin 2x2 $REGION -Fs20c -Bxaf -Byaf+ap -Srl -Scb -A1+gwhite+jTR -M0.05c/0.75c
subplot [WARNING]: Modifier +a detected but not a valid modifier! - ignored

The figure is well created.

The issue is only about the warning message. I don't know why I got it. I think it should NOT appear.

@Esteban82 Esteban82 added the bug Something isn't working label Nov 29, 2024
@joa-quim
Copy link
Member

Don't know. But +a should be followed by a number. Not a p|s directly.

@Esteban82
Copy link
Member Author

But +a should be followed by a number.

+a accepts two shorthands

+an can be used as a shorthand for normal (i.e., +a90) [Default for y-axis] and +ap for parallel (i.e., +a0) annotations [Default for x-axis].

https://docs.generic-mapping-tools.org/dev/reference/options.html#map-frame-and-axes-annotations-the-b-option

@seisman
Copy link
Member

seisman commented Dec 13, 2024

gmt/src/subplot.c

Lines 730 to 752 in fe9a841

if (By) { /* Did get y-axis annotation settings */
if ((c = gmt_first_modifier (GMT, By->arg, "lpsu"))) { /* Gave valid axes modifiers for custom labels */
pos = 0;
while (gmt_getmodopt (GMT, 'B', c, "lpsu", &pos, p, &error) && error == 0) {
switch (p[0]) {
case 'l': /* Regular y-axis label */
Ctrl->S[GMT_Y].label[GMT_PRIMARY] = strdup (&p[1]); break;
case 'p': /* Annotation prefix */
Ctrl->S[GMT_Y].prefix[GMT_PRIMARY] = strdup (&p[1]); break;
case 's': /* Secondary y-axis label */
Ctrl->S[GMT_Y].label[GMT_SECONDARY] = strdup (&p[1]); break;
case 'u': /* Annotation units */
Ctrl->S[GMT_Y].unit[GMT_PRIMARY] = strdup (&p[1]); break;
default: /* These are caught in gmt_getmodopt so break is just for Coverity */
break;
}
}
if (Ctrl->S[GMT_Y].label[GMT_PRIMARY] || Ctrl->S[GMT_Y].label[GMT_SECONDARY]) Ctrl->S[GMT_Y].has_label = true;
c[0] = '\0'; /* Chop off for now */
}
Ctrl->S[GMT_Y].b = subplot_prep_annot_args (Ctrl, By, GMT_Y);
if (c) c[0] = '+';
}

subplot has its own -B parser. From the source code, it seems currently it only allows modifiers +l/+p/+s/+u. I don't know why it was written like this, perhaps we should try to support +a and see if there are any side-effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants