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 back up a WordPress website to remote cloud storage from the Linux command line - November 24, 2015
- How to access Dropbox from the command line in Linux - November 22, 2015
- How to send email notifications using Gmail SMTP server on Linux - November 9, 2015