Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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"

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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