I am trying to (frequently, e.g. every 0.01s) replot a 2D dataset in gnuplot, by generating a small (e.g. 10x10) 2D numpy array in python and saving it to a file.
Running the following works for a couple of seconds and then gnuplot stops with the error, "Scan size of matrix is zero".
gnuplot > plot 'testfile.out' matrix w image
gnuplot > while(1) {replot; pause 0.01;}
How can I get gnuplot to ignore this and continue replotting the data file?
Edit:
The method below works fine for the random number generator, but when I apply it to my actual file the same thing happens with "scan size of matrix is zero". Possibly it's an issue with Python rather than gnuplot? To be precise, I am running setup-and-plot.gp from the answer below:
set term wxt noraise
plot '<flock testfile.out cat testfile.out' matrix w image
while(1) { pause 0.01; replot; }
and then the following Python code:
import time
import numpy as np
while True:
# in actual code array is not random, this is just to debug.
arr = np.random.rand(10,10)
np.savetxt('testfile.out', arr)
time.sleep(.01)
After a few seconds (depending on how long I set the sleep time) it stops again, with the "scan size of matrix is zero" error.