Is there any way to compute a 2 dimensional function using data from a file in gnuplot. Suppose I have a function f(x,y) which exist and I want to calculate the new values with data stored in file data.dat
i.e something like
plot f(x,y) using 'data.dat'$1:'data.dat'$2
The command
plotis used for plotting one variable against another. If you want to plot a third value against two others (and obtain something that looks 3D), you'll need thesplotcommand. In this case, the command would look likeThe
usingkeyword specifies what you want to plot based on the contents of a file. The 1 and 2 means that the x and y coordinates will just be the first and second column in the file. For the third coordinate we want the f(x,y) function to be used with the values from the first and second column filled in ($1 and $2).In case we're doing something more complex than just using a column unmodified, we have to use brackets and a $-sign for the variables. So we also could have written
as the command. See the gnuplot manual for more information.