Bug #347

psclip draws lines through numbers labeling contours in PS files for some viewers

Added by Arthur almost 7 years ago. Updated about 6 years ago.

Status:In ProgressStart date:2013-07-22
Priority:NormalDue date:
Assignee:-% Done:


Target version:Candidate for next bugfix release
Affected version:4.5.x Platform:


For recent versions of GMT on both Mac and Linux, when a script has a sequence like

nearneighbor -R -I20K -S100K -W -N4/2 -Gpsclip_test-mac.nc input.txt
grdcontour psclip_test-mac.nc -R -Gd1.5i -Jm -O -A0.01 -C0.01 -S4 >> $psfile

the numbers along the contours have no lines through them – as it should be.

If instead, one chooses to restrict the area with plotted contours using psclip:

nearneighbor -R -I20K -S100K -W -N4/2 -Gpsclip_test-mac.nc input.txt
psclip cliprange.txt -R -Jm -O -K >> $psfile
grdcontour psclip_test-mac.nc -R -Gd1.5i -Jm -O -A0.01 -C0.01 -S4 -K >> $psfile
psclip -C -O >> $psfile

the contours look fine in $psfile in some programs, but have lines through them in others. Specifically, there are no lines in programs gs, display, and evince. There are strikethroughs in mac preview, texshop, and Adobe programs such as acrobat and illustrator. Most unfortunate is that if one converts the PS file to first an EPS file and then a PDF file, the PDF file has strikethroughs. This is a problem for me when preparing documents using LaTeX.

In the directory in the attached tarball, there are three GMT scripts. They are identical except for filenames of files produced and a plotted text message indicating the computer OS and version of GMT that produced the output files. My personal machine is a Mac (v10.6.8), so I use GMT 4.5.9 (built using macports). I only have a guest account on the two Linux machines so have to use the installed GMT. On one running 4.5.6, I get strikethroughs. Interestingly, on the machine running 4.2, there are no strikethroughs. The ascii .ps files produced by these runs on the different machines are included.

psclip-test.tgz (50.6 KB) Arthur, 2013-07-22 14:59


#1 Updated by Paul almost 7 years ago

  • Status changed from New to In Progress

I can confirm I see the same things you do. Not sure if the clipping in PostScript is implemented improperly in gs so our particular clip model worked fine there, but sending the PS to the printer shows the lines so we will need to reconsider how the clipping must work.

#2 Updated by Florian over 6 years ago

  • Target version changed from 4.5.11 to Candidate for next bugfix release

#3 Updated by Paul about 6 years ago

I have rewritten how contour/quoted line clipping is done, in GMT 5 (not GMT 4). Making a few changes to your code to run in GMT 5 the result looks OK to me. Please give it a shot and let me know. We are not likely to back-port these new procedures to GMT 4.

#4 Updated by Paul about 6 years ago

Sorry, same story. PS converted to raster works correct, but conversion to PDF has a bug. It has to be a bug in the PS2PDF driver in gs.

Also available in: Atom PDF