Gnuplot

Gnuplot PDF Terminal

When producing plots of data by gnuplot one can specify many different output formats:

set terminal png
set output 'plot.png'
plot ...

The output file ‘plot.png’ will contain the image. By replacing ‘png’ by some other format, like ‘gif’ one can change the output format.

Often when producing PDF documents with LaTeX one would like to use images in PDF format for better quality. However due to licensing problems usual installations of gnuplot don’t support PDF output format. One could recompile gnuplot and include the feature manually. But this seems like a lot of hassle especially if you want to produce just one image.

However there is a work around:

set terminal postscript enhanced color

set output '| ps2pdf - plot.pdf'
plot ......

Here we are directing the PS stream into ps2pdf (the ‘-‘ sign in the command states to read the PS file from stdin).

Sometimes the PDF files produced have an extra white border, but there are ways to fight with it. I see this as an easy solution to a small problem. Of course if you want many top quality PDF images, you should recompile gnuplot with PDF support.

Inspired by this post .

Standard

3 thoughts on “Gnuplot PDF Terminal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s