Skip to content

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

Closed

Description

@Esteban82

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.

Activity

  1. added
    bug
    on Nov 29, 2024
  2. joa-quim commented on Nov 30, 2024

    @joa-quim
    Member

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

  3. Esteban82 commented on Nov 30, 2024

    @Esteban82
    MemberAuthor

    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

  4. seisman commented on Dec 13, 2024

    @seisman
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions