Repository navigation
Description
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-Nseems 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




Activity
joa-quim commentedon Mar 20, 2026
So, to be clear, the only error is in Plot 2 that ignores -N?
mkononets commentedon Mar 20, 2026
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".
Fix the case of clipping decorated lines. -N was ignored.
joa-quim commentedon Mar 20, 2026
#8939 should fix Plot 2 (the only problem from what I could get).
joa-quim commentedon Mar 20, 2026
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.
Fix the case of clipping decorated lines. -N was ignored. (#8939)