Main Question

In the Chinese TIEBA community, there is a quite interesting post that have real world application, so I’m going to translate it and post it here to see if anyone can give an elegant result.

  1. How to draw some sort of StreamPlot3D or so?

It seems that though Mathematica has StreamPlot, there’s no such an extension. Note that simply stacking multiple StreamPlot will not do the job.

The input of this function will be a vector field, just like StreamPlot.

  1. How to draw a StreamPlot3D that can show the divergence and curl of the stream’s condition

Sometimes, especially when dealing with fluid dynamics, we’ll need to know how the fluid is compressed or know the rotation condition of the fluid. So by altering the radius of the stream lines’ 3D thickness and color according to the divergence of the corresponding point, we can easily know how the fluid is compressed. By twisting a “belt” according to the curling condition of the fluid will show how the fluid is swirling.

The input of these two functions will be both vector field and velocity field.

Sample Image

The sample image was created by Matlab. (Oh, I hate to find something can be easily done by matlab but not Mathematica.)


Plot with div

Plot with curl

See Matlab's guide to these plotting functions:





  • 1
    $\begingroup$ Could you please include a minimal dataset, or at least a link to the same dataset that was used to plot the figures in Matlab? $\endgroup$ Aug 4, 2016 at 9:28
  • 3
    $\begingroup$ @István According to my understanding for the original post mentioned by OP, this question isn't a duplicate, but I admit OP should have asked the question in a clearer way, for example, these links, which can be easily found by a quick search if one reads the original Chinese post (the function names have been mentioned there!), should have be included in the question: cn.mathworks.com/help/matlab/ref/streamline.html cn.mathworks.com/help/matlab/ref/stream3.html cn.mathworks.com/help/matlab/ref/streamtube.html cn.mathworks.com/help/matlab/ref/streamribbon.html $\endgroup$
    – xzczd
    Aug 4, 2016 at 9:45
  • 1
  • 3
    $\begingroup$ I understood it was made from a vector field (I meant from a plot of streamlines, one cannot see the curl). It would be helpful to be able to examine what was actually computed in the third plot. I don't think it is possible to show curl in this way, except in the rare cases that the curl is parallel to the flow or normal to the flow (would show direction only); if the twisting illustrates only the magnitude of the curl, then I think it's rather misleading. $\endgroup$
    – Michael E2
    Aug 4, 2016 at 13:38
  • 1
    $\begingroup$ You should add the links to the post, not only the names. $\endgroup$
    – xzczd
    Aug 5, 2016 at 1:28

1 Answer 1


Finally, StreamPlot3D and ListStreamPlot3D are introduced in v12.3:


StreamPlot3D[{y, -x, z}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]    

enter image description here


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.