Skip to content

gmt basemap -Bs -Bxaf draws full frame with WS axes annotated #8827

Open

Description

@mkononets

gmt basemap -Bs -Bxaf draws full frame with WS axes annotated instead of just one X axis with ticks and no annotations and no other axes. I believe this is likely a bug. Same with -Bx, -Bxa.

I wanted to plot an X axis with ticks but no annotations for adding annotations externally for a complex plot.

I call gmt basemap -R0/1/0/1 -JX5c -Bs -Bxaf -png test and get a full frame with WS axes annotated and funny unproportionally long ticks:

Image

after some testing I've got the needed result by running gmt basemap -R0/1/0/1 -Jx5c -Bs -B -png test

Image

Activity

  1. added
    bug
    on Nov 11, 2025
  2. mkononets commented on Nov 11, 2025

    @mkononets
    Author

    -Bsn -Bxaf works as expected:

    Image

    -Bw -Byaf works as expected:

    Image

    -Bwe -Byaf works as expected:

    Image
  3. joa-quim commented on Nov 11, 2025

    @joa-quim
    Member

    I think the issue here is -Bs alone is being taken as meaning secondary axis, not south. The long tick make think it glued the primary and secondary axes ticks.

  4. mkononets commented on Nov 11, 2025

    @mkononets
    Author

    Thanks, that makes lot sense! Not a real bug then but the secondary axis config gets precedence.

    Would probably be not bad to have this mentioned somewhere in the docs.

    UPD Wait, why then a full frame gets plotted with two axes get annotated using -Bs -Bxa or -Bs -Bxaf?

    gmt basemap -R0/1/0/1 -JX5c -Bs -Ba -png test produces one axis with primary major ticks:

    Image

    gmt basemap -R0/1/0/1 -JX5c -Bs -Baf -png test produces one axis with primary minor and major ticks as I wanted:

    Image

    While gmt basemap -R0/1/0/1 -JX5c -Bs -Bxa -png test produces warnings and a full frame with two annotated axes (secondary annotated ticks):

    basemap [WARNING]: Your primary x tick interval exceeds the secondary interval.
    basemap [WARNING]: GMT expects it to be the other way around (primary annotations are closest to axis, secondary are further away)
    basemap [WARNING]: Consider correcting your command - proceeding with your selections
    basemap [WARNING]: Your primary x tick interval exceeds the secondary interval.
    basemap [WARNING]: GMT expects it to be the other way around (primary annotations are closest to axis, secondary are further away)
    basemap [WARNING]: Consider correcting your command - proceeding with your selections
    basemap [WARNING]: Your primary x tick interval exceeds the secondary interval.
    basemap [WARNING]: GMT expects it to be the other way around (primary annotations are closest to axis, secondary are further away)
    basemap [WARNING]: Consider correcting your command - proceeding with your selections
    
    Image
  5. mkononets commented on Nov 11, 2025

    @mkononets
    Author

    Now, the below is probably a feature request:

    For Cartesian axes -Bs disables both annotations and the Cartesian axis label no matter that the label was specified explicitly, while -BS plots both the annotations and the label (if specified):
    gmt basemap -R0/1/0/1 -JX5c -Bxaf+l"Distance, km" -Bs -Byaf -png test:

    Image

    gmt basemap -R0/1/0/1 -JX5c -Bxaf+l"Distance, km" -BS -Byaf -png test:

    Image

    Is it possible to enable plotting the Cartesian axis label if it is explicitly specified regardless of the annotation configuration? This is for adding custom annotations externally using gmt text
    Thanks.

  6. joa-quim commented on Nov 11, 2025

    @joa-quim
    Member

    gmt basemap -R0/1/0/1 -JX5c -Bxaf+l"Distance, km" -B -Byaf -png test

    This a typo, no (the -B alone)? Because I get a syntax error.

    Is it possible to enable plotting the Cartesian axis label if it is explicitly specified regardless of the annotation configuration?

    Sorry, I'm not following. Can you give an example.

  7. mkononets commented on Nov 11, 2025

    @mkononets
    Author

    Sorry yes that was a typo, -Bs, that one-liner should read gmt basemap -R0/1/0/1 -JX5c -Bxaf+l"Distance, km" -Bs -Byaf -png test. Corrected also above.

    The on-liner was supposed to produce the below:

    gmt begin test_xlabel_noannot png
     gmt basemap -R0/1/0/1 -JX5c -Bxaf -Bs -Byaf
     gmt text -F+f12p,Helvetica+jMC+cBC+t"Distance, km" -D0p/-20p -N
    gmt end show
    
    Image

    The gap between the label and the axis ticks is left for my custom external annotations.

  8. joa-quim commented on Nov 11, 2025

    @joa-quim
    Member

    So, you wanted that (no need for the -Byaf since you are restricting to south axis alone with the -BS)
    gmt basemap -R0/1/0/1 -JX5c -Bxaf+l"Distance, km" -BS -png test
    produced your above example? That is to not do the automatic annotations in -Bxa part? But that would be a breaking change. Or am I not getting it yet?

  9. joa-quim commented on Nov 11, 2025

    @joa-quim
    Member

    You can't remove them, but you can make them transparent.
    gmt basemap -R0/1/0/1 -JX5c -Baf+l"Distance, km" -BS --FONT_ANNOT_PRIMARY=10@100 -png test

    Image
  10. mkononets commented on Nov 11, 2025

    @mkononets
    Author

    That's a very good workaround. Thanks!

  11. joa-quim commented on May 29, 2026

    @joa-quim
    Member

    Can we close this or is there still something broken?

  12. mkononets commented on May 29, 2026

    @mkononets
    Author

    There's certain ambiguity in when -Bs implies a primary south axis alone and when a secondary axis.

    Is it a bug? Most likely not.

    Is is a documentation issue? Probably yes, but I have no idea how to fix it best. Axis specs can be very complex.

    Two more one-liners to make this example a bit more documented:

    • -Bp -Bs plots primary south axis alone (as I wanted with a single -Bs specification)
    • -Bs -Bs plots secondary south axis alone

    (while -Bs alone plots the full frame with two secondary axes as I complained about i the topic):

    gmt basemap -R0/1/0/1 -JX5c -Bp -Bs -Bxaf -png test-Bp-Bs-Bxaf
    
    gmt basemap -R0/1/0/1 -JX5c -Bs -Bs -Bxaf -png test-Bs-Bs-Bxaf
    
    test-Bp-Bs-Bxaf.pngtest-Bs-Bs-Bxaf.png
    Image Image

    If you (or anybody else) has nothing more to add, this can be closed.

  13. joa-quim commented on May 29, 2026

    @joa-quim
    Member

    I don't see what we can do for the Bs ambiguity but the Bs Bs effect on the ticks length is highly annoying, though I don't even know what to expect as the right thing to do and whatever, it will likely be a considerable amount of work. So, we probably better close this.

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