0
I am using gnuplot and I have two seperate data files and I would like to divide every values of the x-axis from dataset 1 with every value of x-axis with dataset 2. The same with y-axis..How can I do this??
Can I do this from within gnuplot?
0
I am using gnuplot and I have two seperate data files and I would like to divide every values of the x-axis from dataset 1 with every value of x-axis with dataset 2. The same with y-axis..How can I do this??
Can I do this from within gnuplot?
0
You can do this from gnuplot, although it may be easier to preproecss your data externally.
In fact this is quite similar to preprocessing your data externally with some script that takes your data and writes the combined data to standard output. The syntax to use a pipe in gnuplot is
plot " < program arguments"
I usually use AWK for such purposes. To solve your problem, the preprocessing script has to internally join the two datasets somehow and then compute the desired values. In AWK, I would do something like this:
{
if(secondfile)
print $1, $2, values[$1,$2]/$3
else
values[$1,$2]=$3
}
ENDFILE{secondfile=true}
The values from the first file get stored into the values array (secondfile is false). The ENDFILE pattern is run at the end of any (here: first) file and switches the behavior of the main rule to print the coordinates x and y and the divided values (assuming you have "x y value" columns data format). The ENDFILE hook is supported in the current GAWK 4.0.
The final plot command could then look like
plot "< awk '{if(secondfile) print $1, $2, values[$1,$2]/$3 ; else values[$1,$2]=$3} ENDFILE{secondfile=true}' file1 file2" using 1:2:3
(I did not fully understand how you want quantities to be computed, but you can do it in a similar way)