tags:

views:

30

answers:

2

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? Or possibly having bash make a temporary file.

Something like

plot {(1,5),(2,10),(3,1)}

is what I am looking for.

+1  A: 

You should be able to pipe the commands into gnuplot on stdin.

Gian
Could you be more specific? I'm already doing echo 'plot sin(x)' | gnuplot -persist. But I want to replace "sin(x)" with a dataset. How can I input the dataset?
Earl Bellinger
Oh, sorry, I read your question a little bit quickly. However, this list post appears to address the same issue: http://groups.google.com/group/comp.graphics.apps.gnuplot/browse_thread/thread/180d6a19639114bb?pli=1
Gian
+1  A: 

You can use the syntax for inline data - filename '-'.

The following example produces a simple plot in a GIF image (bash script):

gnuplot << EOF
set terminal gif
set output 'plot1.gif'
plot '-' using 1:2
        1 10
        2 20
        3 32
        4 40
        5 50
        e
EOF
gimel