Skip to content

curve embellished with text, a clipping issue #8934

Closed

Description

@mkononets

I'm trying to learn text-embellishment plotting inspired by gmt example 48
I came across that -N clipping fails when plotting a text-embellished line. Example 48 indicates this issue has been known for many years, as the workaround (the adjusted Y axis range) was present as far back as in gmt 5.4. Would be grateful is there's an explanation, could not find any on my own.

Below is my test script producing 4 plots and the plots. A 45 degree arc is generated using gmt math. This line is used to plot a curved text string exactly as in Example 48. Depending on the Y axis range, the curved text string on the plot can be

  • plotted correctly (plot 1) with -R-9/9/0/18, a workaround shown in Example 48 since many years ago.
  • clipped with text missing (plot 2) with -R-9/9/-9/9. Presence of -N seems to be ignored.

All is working good while the plotted object is inside the plot frame. If the plotted object sticks outside it gets clipped regardless of -N is indicated.

Plotting the line w/o text, clipping works as expected for both Y range specifications. Presence of -N is respected. Plots 3 and 4.

# arc, code line from ex48 https://docs.generic-mapping-tools.org/6.6/gallery/ex48.html
gmt math -T45/135/1 T -C0 COSD -C1 SIND -Ca 11.5 MUL = path.txt

# -R-9/9/0/18 -N -Sqn1...: text line plotted
gmt plot -Bxa -Bya -R-9/9/0/18 -Jx1c path.txt -Sqn1:+l"IMPORTANT PACIFIC AIRPORTS"+v+f32p -W10p,magenta -N -png arc+line

# -R-9/9/-9/9 -N -Sqn1... : text removed, -N ignored, arc clipped but in a strange way
gmt plot -Bxa -Bya -R-9/9/-9/9 -Jx1c path.txt -Sqn1:+l"IMPORTANT PACIFIC AIRPORTS"+v+f32p -W10p,magenta -N -png arc_clipped+text_missing

# -R-9/9/-9/9 -N -W10p,magenta: arc alone plotted
gmt plot -Bxa -Bya -R-9/9/-9/9 -Jx1c path.txt -W10p,magenta -N -png arc_plotted

# -R-9/9/-9/9 -W10p,magenta: arc clipped "normally"
gmt plot -Bxa -Bya -R-9/9/-9/9 -Jx1c path.txt -W10p,magenta -png arc_clipped

Plot 1:
Image

Plot 2:
Image

Plot 3
Image

Plot 4
Image

Activity

  1. added
    bug
    on Mar 18, 2026
  2. joa-quim commented on Mar 20, 2026

    @joa-quim
    Member

    So, to be clear, the only error is in Plot 2 that ignores -N?

  3. mkononets commented on Mar 20, 2026

    @mkononets
    Author

    the only error is in Plot 2 that ignores -N?

    I can only literally explain what I see on the Plots and how I think it's wrong.

    The way I used to see clipping working is Plot 4, like careful clipping exactly right along the frame. I imagine that "Just Ignoring -N" on the Plot 2 would leave pieces of letters in place and the line clipped as carefully as on Plot 4.

    So my answer is "no, not just that".

  4. added a commit that references this issue on Mar 20, 2026
    188233e
  5. joa-quim commented on Mar 20, 2026

    @joa-quim
    Member

    #8939 should fix Plot 2 (the only problem from what I could get).

  6. joa-quim commented on Mar 20, 2026

    @joa-quim
    Member

    Righ, and #8939 only fixes the fact that -N was ignores but does not clip through the text. That seems to be a separate issue. The clipping is actually done by ghostscript (it is PostScript language feature) so not even sure if the error ins not in it.

  7. added a commit that references this issue on Mar 20, 2026
    78e53c1
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