Gnuplot with png and pdf terminal

One might get messages like

unknown or ambiguous terminal type; type just ‘set terminal’ for a list

To use png as terminal in GNUPlot, libgd2-dev library is needed (which is not provided in some distributions).

After installing libgd2-dev, one needs to rebuild gnuplot.

Also from: http://xmodulo.com/how-to-export-gnuplot-output-to-png-jpg-and-pdf.html

If you would like to save Gnuplot output as any other formats than those supported by native Gnuplot terminals, you can use redirect operator ¨|¨, to redirect Gnuplot’s native output to an external tool for format conversion.

For example, to export Gnuplot output to pdf format, first install ps2pdf which is contained in ghostscript package. Then redirect Gnuplot’s poscript output to pdf format.

$ sudo apt-get install ghostscript
set terminal postscript
set output '| ps2pdf - output.pdf'

 

This entry was posted in 技术 Tech. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.