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?
You can write something like this directly in gnuplot:
plot "< ./format.sh '{(1,5),(2,10),(3,1)}'"
where format.sh is a pretty simple script in a local file (remember to give it exec permissions):
#!/bin/bash
echo "$1" | sed 's:^..\(.*\)..$:\1:' | sed 's:),(:\n:g' | sed 's:,: :g'
The three sed commands do the following:
{( and })),( to a newline, to spacesSo:
$ ./format.sh '{(1,5),(2,10),(3,1)}'
1 5
2 10
3 1
The gnuplot plot "< command" syntax levers on popen to run command in a shell, capture the output and plot it on the fly. It can be pretty useful also in other circumstances.