0
votes

I have a very long and probably a very daunting question as well. I have a trial.csv file that looks something like this:

ForceX  ForceY  Temp    Speed   Theta   Height
9.724   10.504  88.041   0.7      1      1100
13.938  10.841  99.918   0.7      2      1100
8.771   10.719  75.8     0.8      1      1100
12.71   11.027  85.214   0.8      2      1100

For every speed value there are two sets of values for ForceX, ForceY, Temp and Theta. I would like to plot ForceX against Theta for speed = 0.7 and for speed = 0.8. Now this is easy if there are just two theta values and I can use plot "<(sed -n '2,3p' trial.csv)" using 2:1 with linespoints title "" for the respective speeds.

But the theta value varies from say -2 to +2 and the speed ranges from say 0.6 to 0.9. So now I have 5 sets of values for every speed. (The trial.csv is generated using a 'for' loop using speed as the outer loop and Theta as the inner loop).

How do I plot the range of ForceX with Theta for every speed value in a separate plot? I am quite new to shell scripting and I haven't found a proper solution for about a week now. I hope my problem is clear. Your help is appreciated. Thanks.

Regards, Sou

1

1 Answers

0
votes

There is no need to use shell scripting, you can do this much easier with gnu plot's using directive. For example, to plot ForceX vs. Theta for only those records where Speed is 0.7, use

plot "trial.csv" u 5:($4 == 0.7 ? $1 : 1/0) title "Speed 0.7" w lp

If you want to plot curves for multiple values of Speed try

plot for [speed in "0.7 0.8"] "trial.csv" u 5:($4 == speed ? $1 : 1/0) title "Speed ".speed w lp