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 install Suricata intrusion detection system on Linux - September 3, 2015
- 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