I have a .dat file (which is actually a csv), whose columns are like
x1 y1 z1 w1
x2 y2 z2 w2
x3 y3 z3 w3
. . . .
. . . .
I want to separately obtain contour plots of z(x,y)
and w(x,y)
from the set of data.
I have imported the file with
mydata = Import["filename.dat","CSV"];
Now I can form the vectors containing x, y, z values with
x = mydata[[All, 1]];
y = mydata[[All, 2]];
z = mydata[[All, 3]];
How to do the contour plot? The ContourPlot
function works with a function, not points.
I don't necessarily need to interpolate between the points to make it a smooth function. If there is some way to plot densities at discrete points, that will also do. However, if there is a way to do this with interpolation, or if there is some inbuilt routine to achieve this, I am also interested to know about that.
The function ListContourPlot
requires a n x 3
matrix, but my data is n x 4
. How can I select a column specifically?
ListContourPlot
? See ifListContourPlot[ mydata[[All, ;;3]] ]
andListContourPlot[ mydata[[All, {1, 2, 4}]] ]
do what you want. $\endgroup$