When you write a Gnuplot script for plotting data, the script typically loads data from separate data file(s). This means that you need to maintain Gnuplot scripts and raw data files separately. It will be nice if a Gnuplot script is able to plot data without relying on external data files.
If you want to plot data without data files with Gnuplot, you can use a special filename named '-', which allows you to include raw data inline within scripts. For example, you can include raw data in your Gnuplot script as follows.
plot '-' using 1:2 title "My Plot" with lp 1 30 2 40 3 35 4 60 5 50 EOF
If you want to draw multiple plots, each of which is based on a different set of raw data, you can specify as many instances of '-' as you want in your Gnuplot script.
plot '-' using 1:2 title "My Plot 1" with lp, \ '-' using 1:2 title "My Plot 2" with lp 1 30 2 40 3 35 4 60 5 50 EOF 1 20 2 40 3 40 4 50 5 60 EOF
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