Skip to content

Inconsistent behavior for directional rose #8841

Open

Description

@seisman

Originally reported in GenericMappingTools/pygmt#4025 (comment).

The issues are:

  • Directional roses are plotted at bottom-left (x0/0) by default, but it seems the anchor point is "BL" for a simple rose and "MC" for a fancy rose. So, the behavior is inconsistent.
  • The box is not drawn for the simple rose when the position is x0/0
  • Setting position to jBL looks good, but the box for the simple rose seems to be a square which doesn't fit the simple rose well.
gmt begin map png
	gmt basemap -R100/110/30/35 -JM10c -Baf
	gmt basemap -Td+w2c -F+pblue
	gmt basemap -Td+w2c+f -F+pred

	gmt basemap -R100/110/30/35 -JM10c -Baf -Xw+2c
	gmt basemap -Tdx0/0+w2c -F+pblue
	gmt basemap -Tdx0/0+w2c+f -F+pred

	gmt basemap -R100/110/30/35 -JM10c -Baf -Xw+2c
	gmt basemap -TdjBL+w2c -F+pblue
	gmt basemap -TdjBL+w2c+f -F+pred
gmt end show
Image

Another issue is the default width. The GMT docs say the default width is 10%, but the following script crashes

gmt begin map png
	gmt basemap -R100/110/30/35 -JM10c -Baf
	gmt basemap -Tdx0/0 -F+pblue
	gmt basemap -Tdx0/0+f -F+pred
gmt end show

The error message is:

basemap [ERROR]: Option -T:  Correct syntax
basemap [ERROR]: 	-T[f|m][x]<x0>/<y0>/<size>[/<info>][:wesnlabels:][+<gint>[/<mint>]]
basemap [ERROR]: Could not decode dx0, return NaN.
basemap [ERROR]: Option -T: Could not parse geographic coordinates dx0 and/or 0
basemap [WARNING]:  not a valid number and may not be decoded properly.
basemap [ERROR]: Option -T:  Size must be positive
basemap [ERROR]: Option -T:  <kind> must be 1, 2, or 3

The default width works well if position is not x0/0. I think it's because when x0/0 is used, GMT fallback to the old GMT syntax, which doesn't have default width set.

Activity

  1. added
    bug
    on Dec 19, 2025
  2. joa-quim commented on Jul 1, 2026

    @joa-quim
    Member

    Things changed after #9074. And I don't get any error Could not decode dx0, return NaN. There are still differences fancy/nofancy but are they bugs? (didn't investigate it).

  3. Esteban82 commented on Jul 7, 2026

    @Esteban82
    Member

    I looked into this issue. The problems are easier to reproduce with this command:

    gmt psbasemap -R100/110/30/35 -JM10c -Baf -TdJBL+w2c -F+pblue -png bug

    Image

    This shows three related issues,

    1. The panel is always square instead of matching the rose's actual footprint. This one's straightforward to fix. I will make a PR soon.
    2. The plain (simple) north rose is always forced to stay inside the map frame. I think this clamp only exists for the plain rose type and it was implemented for the cases when a rose sits near a corner/edge and gets rotated (e.g. for oblique projections, or just non-north-up local declination), this keeps the whole plain-rose symbol visible instead of letting part of it spill past the frame. I have a patch that simplifies this else function to fix this.
    3. That inside-the-map shift is never applied to the panel: The blue box stays at the originally requested position while the rose itself gets nudged inward.

    Proposed fixes:

    • For 2 is trickier — it's not really a bug, it's an intentional feature. This will break back-ward compatiliby and maybe probably break some tests. I suspect it's quite old (since it only applies to simple north directions). I even think it predates the jBL mechanism. I'd be in favor of breaking this compatibility. I consider it a bug that you can't plot "north" outside the map.
    • 3 is also easy to solve (once we decide what to do with 2).

    Please let me know your specific opinion regarding point 2.

  4. Esteban82 commented on Jul 11, 2026

    @Esteban82
    Member

    @joa-quim. @seisman any comments on issue 2 ("the simple north is forced to stay inside")?

  5. seisman commented on Jul 11, 2026

    @seisman
    MemberAuthor

    think this clamp only exists for the plain rose type and it was implemented for the cases when a rose sits near a corner/edge and gets rotated (e.g. for oblique projections, or just non-north-up local declination), this keeps the whole plain-rose symbol visible instead of letting part of it spill past the frame.

    But why does the fancy rose not forced inside the frame?

  6. Esteban82 commented on Jul 11, 2026

    @Esteban82
    Member

    I'm not sure. I suspect that maybe at the time, Paul? forgot to implement it for the “fancy rose.” Or, for some specific reason (perhaps related to the fact that the “fancy rose” is square and the “simple” one isn't). I could try to find out when it was implemented. Or maybe Joaquim knows.

  7. added
    discussion
    on Jul 13, 2026
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

    bugdiscussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions