I would like to use ListPlot3D
to make a 3D plot using a file containing the following information (4 columns):
x, y, f(x,y), w(x,y).
Here x
and y
are the coordinates in the Cartesian framework, f(x,y)
is some function that depends on x
and y
, and w(x,y)
is another function that represents weights of the function f
. So for each data point in f(x,y)
we have the corresponding weight w(x,y)
.
To plot the function f(x,y) I do the following:
f = Import["file.dat", "Table"];
ListPlot3D[f]
and that is fine.
Now I want to have this plot but with colours determined by the weights, i.e. for each point in "f" I would like to have the colour determined by the value of "w". Suppose "w" takes values from 0 to 1, I want that 0 corresponds to "blue" and 1 corresponds to "red", and all values in-between is the gradient between "blue" and "red". For example, if I have a row in "file.dat": 0, 1, 10, 0.5, I would like a 3D plot where at (x,y)=(0,1) the value of the function is f=10 and the colour of this point is 50% blue and 50% red. Can you suggest please how to do this in Mathematica?
ColorFunction
andBlend
are the two functions you want to look into. $\endgroup$