Donnerstag, 3. November 2011

GNUPlot 002: EPS Bounding Box

I plot some data in gnuplot and want to include it in a Latex document. One option is to use the gnuplot terminal "postscript enhanced eps" and print to an eps file. The eps file can be converted to a PDF and then included in the Latex document which is compiled with pdflatex. However, it may happen that the bounding box is too large and then the diagram takes up too much space. And nobody wants to hand-edit the bounding box, or manually select the graph in Preview and save manually to pdf.

What I now do is to use gnuplot terminal "postscript enhanced" and print to ".ps" file. Then I use the tool ps2eps, which generates a better bounding box. The call is


ps2eps -f -B -l -R + data.ps

-f: forces overwrite of existing eps files, -B recalculates bounding box, -l adds a bit to it, so it does not terminate on the labels, -R + sometimes rotation is required. No output file is required.

Then, the .eps file is opened in preview and saved to PDF. If using "convert" again PDF will have a too large white space margin, probably there are some options to adjust this, havent found them yet.

Another option (Credits: Janus)
http://www.gnuplot.info/scripts/files/fixbb

Keine Kommentare:

Kommentar veröffentlichen