Rotate a postsript file 90 degrees

So useful it deserves it's own page...

I was experiencing problems including ps files inside my tex documents... this is a list of some of the solutions I've tried/used. I usually use gnuplot to generate graphs and have found that using the terminal types pstex or postscript eps usually gives satisfactory results (Method 7 below).

Although some commands will rotate your postscript file, it may get rotated when including in the tex document to make it wrong again, for this reason it is best to use encapsulated postscript so that you have a clue about the position of the bounding box.

WARNING: These methods may not work for you today

This page is for your information, please send any feedback you can, see my contact details.

Method 1: in the a tex file

This is the way to do this when including an image inside a latex document;

\caption{Hardness as a function of the isothermal transformation temperature.}

You can change the include graphics statement to be \includegraphics[angle=90,width=14cm]{relativepath/}

This can cause all sorts of problems when pdflatex or latex decide to handle images differently, or you dont know enough about .sty files like myself. Not that I am a style file.

This method is reported to work with dvips but not with pdflatex

Method 2: Image manipulation

Open in image software, rotate image, save image. Pros: Works, Cons: Lossy and time consuming

Method 3: convert or mogrify on the command line

Read manual pages for convert and or mogrify. I used convert -rotate 90 Pros: Works after you work out the command, Cons: Lossy, command options depend on system.

Method 4: use postscript tools to rotate image on the command line

Read manual pages for ps, ps2ps, psnup, search the flipping web. I used psnup -l Pros: Works Cons: non.

According to the forum post I read this command from, it doesn't work if you need to rotate more than 90 degrees, because it is changing a value in the ps file to make it landscape or portrait. psnup is a tool for printing multiple pages per sheet. The manual page says (amongst other things) this:

 The  -l option should be used for pages which are in landscape orienta-
 tion (rotated 90 degrees anticlockwise). The -r option should  be  used
 for  pages which are in seascape orientation (rotated 90 degrees clock-
 wise), and the -f option should be used for pages which have the  width
 and height interchanged, but are not rotated.

Method 5: cludgy resize for gnuplot/latex

In gnuplot it is possible to generate the file in landscape/portriat mode, making the graph use the full page and then resize using 'height' and 'width' options when the image is included in the tex file.

Method 6: use pstex for gnuplot

The terminal pstex in gnuplot usually generates graphs that latex is happy to keep in the correct orientation, it also means the same fonts will be used for the graph as the rest of the document, avoiding having them mangled and resized in unsightly ways.

Method 7: use eps in gnuplot

I found that rotating images is a particular problem for postscript files generated by gnuplot, after successfully rotating them, they are rotated back into the wrong orientation when compiling the latex document. This problem can be avoided by using eps, this is done in gnuplot by specifying:

set terminal postscript eps


set terminal postscript enhanced eps

but not

set terminal postscript enhanced

Method 8: Convert to eps

using ps2epsi - untested