I have data file coming from a fortran code. The data are 2 arrays v and np of size 500 and a scalar time. Each time I append to a file the new time value and the 2 vectors in 2 new lines of the file, in this format:
time, v(1), v(2), v(3), ..., v(499), v(500)
time, np(1), np(2), np(3), ..., np(499), np(500)
For example:
0.0, 1.0, 2.0, 3.0, ..., 499.0, 500.0
0.0, 0.1, 0.2, 0.3, ..., 0.499, 0.500
1.0, 1.0, 2.0, 3.0, ..., 499.0, 500.0
1.0, 0.1, 0.2, 0.3, ..., 0.499, 0.500
2.0, 1.0, 2.0, 3.0, ..., 499.0, 500.0
2.0, 0.1, 0.2, 0.3, ..., 0.499, 0.500
What i want, is to plot np
as a function of v
at an specific time (So in this case if i want time=2
i will plot lines 5 and 6 with ignoring the first row). However gnuplot doesn't like this format. I made it work using python, however i must do it with gnuplot.
I searched online and found that i can output my data in another format but this doesn't work properly either. This format looks like this:
0.0 0.0
1.0 0.1
2.0 0.2
3.0 0.3
4.0 0.4
... ...
499.0 0.499
500.0 0.500
1.0 1.0
1.0 0.1
2.0 0.2
3.0 0.3
4.0 0.4
... ...
499.0 0.499
500.0 0.500
2.0 2.0
1.0 0.1
2.0 0.2
3.0 0.3
4.0 0.4
... ...
499.0 0.499
500.0 0.500
This format plots everything including the time and even using for
loops and every
function it doesn't work.
I also searched if I could format my data in columns in fortran, however i couldn't find any solution to that. The problem i have is that at each time, the arrays v
and np
are erased from memory. And for reasons I can't explain, I can't save v
and np
in a matrix and save them for later.
Is there a way i can format my data on fortran to read it on gnuplot and be able to plot only one time ?
Or is there a way i can read this format using only gnuplot ?