1989

Question:
I have two data files, file1.dat and file2.dat. I use following commands to draw two functions.
stats 'file1.dat' u 4:7
plot 'file1.dat' u 4:($7-STATS_min_y)
stats 'file2.dat' u 4:7
replot 'file2.dat' u 4:($7-STATS_min_y)
Problem is that the replot command uses the min_y of file2 and applies to file1.dat once again. How can I handle this? Many thanks.
Answer1:The replot
command repeats the previous plot
command and adds a new plot. If one variable (STATS_min_y
) is used in both commands, the same value is used. You can use e.g. the name
parameter for the stats
command to save the values in different variables:
stats 'file1.dat' u 4:7 name 'F1_'
plot 'file1.dat' u 4:($7 - F1_min_y)
stats 'file2.dat' u 4:7 name 'F2_'
replot 'file2.dat' u 4:($7 - F2_min_y)
In that case you could of course also use a single plot
command:
stats 'file1.dat' u 4:7 name 'F1_'
stats 'file2.dat' u 4:7 name 'F2_'
plot 'file1.dat' u 4:($7 - F1_min_y), 'file2.dat' u 4:($7 - F2_min_y)