Using gnuplot 4.2, is it possible to obtain the value of a specific column/row and use that value somehow?
For example, let's say my datafile contains the following
#1 2
7 13
5 11
23 17
53 12
For a simple plot where column 1 is the x axis and column 2 is the y axis I would:-
plot 'datafile' using 1:2
What I'm trying to do is to normalize the all data in column 2 by the first element in that column (13). Is there a way to do this in gnuplot itself (i.e., without resorting to a scripting language or something to preprocess the data first)?
Cheers
Best Answer
Using the running averages demo, I managed to achieve a plot normalized to the first value of the second column.
The
base
variable is used to store the reference value, and thefirst
function initializesbase
on the first row.It should be mentioned that this was not done using gnuplot 4.2.
Edit: Updated using Christoph's advice.