Skip to content

curve embellished with text, a clipping issue #8934

@mkononets

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions