Gnuplot allows you to export its output to different formats. To export Gnuplot output, you just specify a terminal which then, depending on the type of the terminal, determines the format of output file. Gnuplot supports terminals for various formats including png, jpg, gif and postscript. In order to export Gnuplot output to one of these formats, you simply specify a corresponding terminal in Gnuplot.
To export Gnuplot output to png format:
set terminal png size 400,300 enhanced font "Helvetica,20" set output 'output.png'
To save Gnuplot output as jpg format:
set terminal jpg color enhanced "Helvetica" 20 set output "output.jpg"
To convert Gnuplot output to gif format:
set terminal gif color enhanced set output "output.gif"
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.
set terminal postscript set output '| ps2pdf - output.pdf'
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015
- How to configure virtual hosts in Apache HTTP server - August 24, 2015