views:

255

answers:

2

Hi I have used gmt to create several .ps files of x - y graphs with identical axes. I have several sets of data, each containing between 14 and 20 plots. Each plot is in a separate directory.

I would like to overlay every .ps within a dataset, in order to show correlation between the plots.

I know this is similar to the thread posted here:

http://stackoverflow.com/questions/501723/overlay-one-pdf-or-ps-file-on-top-of-another

but I don't have to deal with multiple pages.

I'm not a programmer, I'm a student! I would really appreciate a quick-ish way to stack them on top of each other to see an overall trend.

If not, I'm off to buy a stack of OHP films and find the nearest photocopier.... which would not look nearly as shiny.

All help is appreciated!

A: 

Well, the Inkscape website says it can import PostScript. take that with a grain of salt, though- I haven't tried it myself.

Alternately, if you don't mind getting your hands a little dirty, PostScript is a fairly human-readable stack based programming language- I highly recommend A First Guide To PostScript. If you can figure out what chunk of the documents contains the plot you want, you ought to be able to copy and paste those together. This all depends heavily upon the quality and organization of code generated by GMT.

Your best bet is probably a vector graphics application like Inkscape (above) or Adobe Illustrator.

JohnE
There is nothing else in the document. That is why my lack of knowledge is so frustrating. I literally want to print the files on top of each other.GMT scripts that created the plots are *very* hacked together (I don't mind admitting that, as I wasn't the one to write them!) Just one takes a little while to load up, which is why I'd rather work with the ps files. Unless that is not what you meant?
Sam
Sam, let me try to clarify- a .ps file is a PostScript program that, when executed by a printer or your print spooler, generates graphics and text. If you just open the .ps file in a text editor, the code's right there. Check out the second link I posted, which explains how PostScript works.That said, .ps files can *also* be opened in some vector graphics applications like Inkscape, which should allow you to manipulate them as images without sacrificing quality. Download Inkscape and try importing the plots and layering them on top of one another.
JohnE
A: 

I've done something like this before, using GMT to produce two plots (of opposite sides of the Earth) to PS and overlaying them, one flipped 180 degrees and reflected (that is, depicting the Earth as a projective plane with each point equated with its antipode).

This was my code:

#!/bin/sh

GMT gmtset BASEMAP_FRAME_RGB +192/192/192
GMT gmtset BASEMAP_FRAME_RGB 0/0/0
GMT pscoast -JS-60/0/16 -R0/360/-90/90 -Di -A5000 -N1 -W -GP300/15:FLightRedB- -SWhite -P -K > mapa.ps
GMT pscoast -JS120/0/16 -R0/360/-90/90 -Bg30/g15 -Di -A5000 -N1 -W -GP300/15:FLightGreenB- -Sp1/50:F-B- -P -O > mapb.ps
sed -i 's/595 842/600 600/g' mapa.ps
sed -i 's/PSL/180 rotate -1 1 scale 0 -1890 translate \nPSL/' mapb.ps
cat mapa.ps mapb.ps > mapc.ps
ps2pdf mapc.ps

Commenting out the second sed line overlays them without flipping the second one. You can probably achieve what you want by tweaking this script and replacing the GMT commands with whatever you're using. The -O option used for the second plot sets overlay mode, which omits the PS code that triggers the creation of a new page. Then you can just cat them together.

KirarinSnow