0
votes

I'm fairly new to gnuplot and I'm trying to see how my array varies with iterations of my program to debug, I would ideally like to be able to make an animation of the data.

Here's what my data looks like:

'q=0'

1 0 0 

0 1 1

1 1 0 

'q=1'

1 0 0  
0 1 1  
0 1 0  

and so on.

I tried using: plot "matrix.dat" index 0 matrix with image, just to plot the first matrix but I got "Warning matrix contains missing or undefined values, Matrix does not represent a grid".

1

1 Answers

0
votes

I think the problem may be the comment lines. When I used this version of your data file

1 0 0
0 1 1
1 1 0

1 0 0 
0 1 1 
0 1 0

plotting with index works. To make an animation, you could create a series of .png files and stitch them together with another application. An example of the gnuplot code to make the .pngs would be:

set terminal png
do for [i=0:100] {
    set output sprintf('matrix%03.0f.png',i)
    plot 'data.dat' index i matrix with image
}