Reputation: 207
I need to plot iteration (not i) versus f(i) in row 2 of each 2nd block. I marked the values with '*'. I tried to come up with some solution using 'every' but could not figure out how to plot data from two separate blocks against one another. There are multiple blocks that proceed with this pattern. I chose to only show 1 repetition. It is a last resort option to reformat the data. I would like to devise a way to plot the data in the current format. Can anyone offer some insight?
i f(i) x(i) iteration = 0*
1 0.000E+00 1.478E-02 Vlnp
2 -1.000E-06* 7.352E-01 Vvnp
3 0.000E+00 7.512E-01 rhovnp
4 -9.721E-01 9.180E+02 Pnp
5 9.721E-01 4.380E+06 hvnp
6 1.000E-06 1.000E-06 mdevap
i f(i) x(i) iteration = 1*
1 -2.776E-17 -1.265E+02 Vlnp
2 1.985E-10* 1.273E+02 Vvnp
3 -1.224E-03 4.292E+03 rhovnp
4 -9.983E-01 9.180E+02 Pnp
5 1.018E+00 -2.560E+10 hvnp
6 4.468E-08 3.250E+06 mdevap
Upvotes: 2
Views: 830
Reputation: 3694
I highly recommend to restructure your data. That can be done also inline in gnuplot using tools as grep
, awk
and sed
. This is a working example.
plot "< grep '*' kxkdata | awk '/^ i/ {printf $6\" \"} /^ 2/ {print $2}' | sed 's/\*//g'"
Basically <
means to read from a kind of subshell (I called your file kxk7607). For the usage of the command line tools, you can find information online.
Upvotes: 1