4
$\begingroup$

I have data in the form of x, y, vx, vy where vx and vy are components of the velocity vector at point x,y.

I want to plot a contourplot of this. How can I do that since contourplot asks for three values?

testBC = Import["...test.dat", "Table", "IgnoreEmptyLines" -> True];
testBCx = testBC[[All, 1]];
testBCy = testBC[[All, 2]];
ux = testBC[[All, 3]];
uy = testBC[[All, 4]];
u = Transpose[{ux, uy}];
testbdry = Transpose[{testBCx, testBCy}];
ListContourPlot[testbdry, u]

I am not sure which one is right, ContourPlot or ListContourplot. I am trying to look for something that provides "heat plotting"

$\endgroup$

1 Answer 1

4
$\begingroup$

For your type of data there are a few types of plots showing vector flow through the contours. So the data structure understood by these plots is of the form:

{{{x1,y1},{vx1,vy2}}, ...}

Let's make it up:

data = Table[{{x, y}, {-1 - x^2 + y, 1 + x - y^2}}, {x, -3, 3, 0.1}, {y, -3, 3, 0.1}];

Now the plots

ListVectorDensityPlot[data, Mesh -> 10, 
 MeshShading -> ColorData[51, "ColorList"], MaxRecursion -> 2]

enter image description here

ListStreamDensityPlot[data, MaxRecursion -> 4, 
 ColorFunctionScaling -> False, 
 ColorFunction -> 
  Function[{x, y, vx, vy, n}, ColorData[22][Round[n]]]]

enter image description here

ListStreamPlot[
 Table[{-1 - x^2 + y, 1 + x - y^2}, {x, -3, 3, 0.2}, {y, -3, 3, 0.2}],
  Mesh -> 10, MeshShading -> ColorData[11, "ColorList"], 
 MeshStyle -> Directive[Red, Dashed]]

enter image description here

There are also functions ListLineIntegralConvolutionPlot and ListVectorPlot.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.