My program generates bash scripts that call gnuplot. I don\'t want to have to make an extra file to store the data; is there any way I can explicitly call all of the values?
Gnuplot 5.0.1 datablocks
main.gnuplot
$data << EOD
1 1
2 4
3 9
4 16
EOD
plot "$data" \
with linespoints \
title "my data"
Convert to PNG:
gnuplot -e 'set terminal png' -e 'set output "main.png"' main.gnuplot
Output:
This method is a bit more versatile than '-' as it makes it easier to reuse the same data multiple times, including on the same plot command: How to embed multiple datasets in a gnuplot command script for a single plot command?
Version 5 is available on Ubuntu 15.04, or compile from source with: https://askubuntu.com/a/684136/52975
You may also be interested in the + and ++ special file names when plotting with functions.
Tested on Ubuntu 18.10, gnuplot 5.2.