I'm trying to create a live animation with gnu plot using the reread command.
my main program outputs a series of data files like
0.0000000.dat
0.1000000.dat
10.500000.dat
etc. and I want the script to serially plot each of these files and stop when it runs out of file (pause on the last one).
This is what I have so far. Get_File_Name is a bash function which formats the file names properly.
source ~/Source_Me/*.sh
shopt -s expand_aliases
### Process input parameters
if [ "$1" ];
then
Time=$1
else
echo "No start time detected, starting at 0.0"
Time=0.0
fi
if [ "$2" ];
then
Increment=$2
else
echo "No time increment specified. choosing 0.1"
Increment=0.1
fi
if [ "$3" ];
then
FrameDelay=$3
else
echo "No frame delay time specified, choosing 0.25 s"
FrameDelay=0.35
fi
FileName=$(Get_File_Name $Time orbs)
# Do this from command line
#Do the plotting
gnuplot << EOF
t = $Time
print t
set pm3d map
splot "$(Get_File_Name $Time orbs)" u 1:2:8
pause 1
### Increment the time somehow
### reread conditionally upon the existence of the next file
EOF
I know that you can call a bash function within gnu plot using
system "<command>"
but this creates a new environment which can't manipulate existing variables. I can't figure out how to manipulate the bash variables within the gnu plot block.
gnuplot << EOF
EOF
How can I increment the time and filename variable within the gnuplot block?
gnuplotis within abashloop yet it doesn't appear to be.gnuplotinside abashloop then the plot window would close between each iteration. This is unacceptably slow. If I used the nativegnuplotcommandrereadthen the same plot window would remain open and the displayed data would change. As I understand itrereadwould loop back to thegnuplot << EOFevery time it is hit. If I putrereadin a conditional statement as indicated in the###, this would effectively give me a while loop insidegnuplotTime+= $Incrementinside thegnuplot <<EOFEOFblock