WOLFRAM

StreamPlot3D[{vx,vy,vz},{x,xmin,xmax},{y,ymin,ymax},{z,zmin,zmax}]

plots streamlines for the vector field {vx,vy,vz} as functions of x, y and z.

StreamPlot3D[{vx,vy,vz},{x,y,z}reg]

takes the variables {x,y,z} to be in the geometric region reg.

Details and Options

Examples

open allclose all

Basic Examples  (4)Summary of the most common use cases

Plot streamlines through a vector field in 3D:

Out[1]=1

Use tubes to show the streamlines:

Out[1]=1

Include a legend for the vector field magnitudes:

Out[1]=1

Plot streamlines over an arbitrary region:

Out[1]=1

Scope  (12)Survey of the scope of standard use cases

Sampling  (3)

Specify the density of seed points for the streamlines:

Out[1]=1

Specify specific seed points for the streamlines:

Out[1]=1

Plot streamlines over a specified region:

Out[1]=1

Presentation  (9)

Streamlines are drawn as lines by default:

Out[1]=1

Use 3D tubes for the streamlines:

Out[2]=2

Use flat ribbons:

Out[3]=3

Use "arrow" versions of the stream markers to indicate the direction of flow along the streamlines:

Out[1]=1

Arrows on tubes:

Out[2]=2

Ribbons are turned into arrows by tapering the heads and notching the tails of the streamlines:

Out[3]=3

Use a single color for the streamlines:

Out[1]=1

Use a named color gradient for the streamlines:

Out[1]=1

Include a legend for the field magnitude:

Out[1]=1

Use StreamScale to split streamlines into multiple shorter line segments:

Out[1]=1
Out[2]=2

Increase the number of points in each segment and increase the marker aspect ratio:

Out[1]=1

Use a theme:

Out[1]=1

Use a log scale for the x axis:

Out[1]=1

Reverse the y scale so it increases toward the bottom:

Out[2]=2

Options  (42)Common values & functionality for each option

BoxRatios  (2)

By default, BoxRatios is set to Automatic:

Out[1]=1

Make the box twice as long in the x direction:

Out[1]=1

PlotLegends  (3)

No legends are included by default:

Out[1]=1

Include a legend that indicates the vector field norm:

Out[1]=1

Specify the location of the legend:

Out[1]=1

PlotTheme  (1)

Specify a theme:

Out[1]=1

RegionBoundaryStyle  (4)

Show the region defined by a RegionFunction:

Out[1]=1

Use None to avoid showing the boundary:

Out[1]=1

Specify the color of the region boundary:

Out[1]=1

The boundaries of full rectangular regions are not shown:

Out[1]=1

RegionFunction  (4)

Plot streamlines in a ball:

Out[1]=1

Plot streams only where the field magnitude exceeds a given threshold:

Out[1]=1

Region functions depend, in general, on seven arguments:

Out[1]=1

Use RegionBoundaryStyleNone to avoid showing the boundary:

Out[1]=1

ScalingFunctions  (1)

Use a log scale for the x axis:

Out[2]=2

Reverse the y scale so it increases toward the bottom:

Out[1]=1

StreamColorFunction  (4)

Color the streams by their norm:

Out[1]=1

Use any named color gradient from ColorData:

Out[1]=1

Color the streamlines according to their x value:

Out[1]=1

Use StreamColorFunctionScalingFalse to get unscaled values:

Out[1]=1

StreamColorFunctionScaling  (2)

By default, scaled values are used:

Out[1]=1

Use StreamColorFunctionScalingFalse to get unscaled values:

Out[1]=1

StreamMarkers  (5)

By default, lines are used:

Out[1]=1

Draw the streamlines as tubes:

Out[1]=1

Draw them as flat ribbons:

Out[2]=2

"Arrow" stream markers automatically break the streamlines into shorter segments:

Out[1]=1

Use 3D arrowheads on tubes:

Out[2]=2

Use directional ribbons:

Out[3]=3

Make segmented markers continuous:

Out[1]=1

Break continuous markers into segments:

Out[1]=1

StreamPoints  (4)

Use automatically determined stream points to seed the curves:

Out[1]=1

Specify a maximum number of streamlines:

Out[1]=1

Give specific seed points for the streams:

Out[1]=1

Use coarsely spaced streamlines:

Out[1]=1

Use more finely spaced streamlines:

Out[2]=2

StreamScale  (9)

Segmented markers have default lengths, numbers of points and aspect ratios:

Out[1]=1

Modify the lengths of the segments:

Out[1]=1

Specify the number of sample points in each segment:

Out[1]=1

Modify the aspect ratios for the stream markers:

Out[1]=1

Make segmented markers continuous:

Out[1]=1

Break continuous markers into segments:

Out[1]=1

The aspect ratio controls the thickness of ribbons and tubes:

Out[1]=1

Increase the width of the ribbons and tubes:

Out[2]=2

The aspect ratio controls the sizes of arrowheads:

Out[1]=1

Control the number of points in each segment:

Out[1]=1

StreamStyle  (3)

Change the appearance of the streamlines:

Out[1]=1

StreamColorFunction takes precedence over StreamStyle:

Out[1]=1

Use StreamColorFunctionNone to specify a streamline color with StreamStyle:

Out[1]=1

Applications  (10)Sample problems that can be solved with this function

Basic Applications  (1)

Consider a vector differential equation where f(x)=If[TemplateBox[{x}, Norm]<=1,x,{1,0,0}] is defined piecewise.

Visualize solutions of using seed points for the streamlines that are inside the unit sphere:

Out[1]=1

Fluid Flow  (3)

Consider Stokes flow for a point force of the form , where is a constant vector and is a Dirac delta function. For example, a force pointing down:

Define the fluid velocity vector , the pressure and the viscosity :

Confirm that the equations for Stokes flow are satisfied so that and :

Out[6]=6

Plot streamlines for the flow:

Out[7]=7

Visualize Stokes flow around a unit sphere. Define the fluid velocity vector , the pressure , the viscosity and the far-field fluid speed :

Confirm that the equations for Stokes flow are satisfied so that and :

Out[2]=2

Plot streamlines for the flow:

Out[3]=3

Plot the pressure for the flow:

Out[4]=4

Specify the NavierStokes equations for a fluid through a pipe with a bulge:

Specify the geometry for the flow:

Out[2]=2

Specify the boundary conditions for flow from left to right:

Solve for the flow velocities and pressure:

Specify seed points for the streamlines:

Plot the streamlines for the flow:

Out[6]=6

Electrical Systems  (1)

Visualize electric field lines for a dipole:

Out[1]=1

The streamlines appear to have uniform color because of the extremely rapid change in the vector field norm near the point charges at . Bounding the magnitude of the vector field norm with a region function makes the colors visible:

Out[186]=186

Add spheres to indicate the positive (red) and negative (black) point charges:

Out[187]=187

Arrows can be used to provide more information, but the colors change because arrow markers are colored by the field magnitude at the tip of the arrow:

Out[188]=188

Use a custom StreamColorFunction to exert more control over the colors:

Out[189]=189

Miscellaneous  (5)

Lorenz attractor:

Out[1]=1

Use ribbons or arrow ribbons to visualize the torsion of a twisted cubic:

Out[1]=1

Visualize solutions of differential equations on manifolds:

Out[1]=1

Visualize streamlines for Poiseuille flow. The fluid speed is fastest along the central axis:

Out[1]=1

Visualize solutions of Euler's equations for a rotating rigid body:

Out[1]=1

Properties & Relations  (9)Properties of the function, and connections to other functions

Use VectorPlot3D to visualize a field with discrete arrows:

Out[1]=1

Use ListStreamPlot3D or ListVectorPlot3D to generate plots based on data:

Out[4]=4

Use StreamPlot to plot streamlines of 2D vector fields:

Out[1]=1

Use VectorPlot to plot with vectors instead of streamlines:

Out[2]=2

Generate plots based on data:

Out[4]=4

Use StreamDensityPlot to add a density plot of the scalar field:

Out[1]=1

Use VectorDensityPlot to plot with arrows instead of streamlines:

Out[2]=2

Generate plots based on data:

Out[4]=4

Use LineIntegralConvolutionPlot to plot the line integral convolution of a vector field:

Out[1]=1

Use VectorDisplacementPlot to visualize the deformation of a region associated with a displacement vector field:

Out[1]=1

Use ListVectorDisplacementPlot to visualize the same deformation based on data:

Out[3]=3

Plot vectors along surfaces with SliceVectorPlot3D:

Out[1]=1
Out[3]=3

Use VectorDisplacementPlot3D to visualize the deformation of a 3D region associated with a displacement vector field:

Out[1]=1

Use ListVectorDisplacementPlot3D to visualize the same deformation based on data:

Out[3]=3

Use ComplexVectorPlot or ComplexStreamPlot to visualize a complex function of a complex variable as a vector field or with streamlines:

Out[1]=1

Use GeoVectorPlot to plot vectors on a map:

Out[1]=1

Use GeoStreamPlot to plot streamlines instead of vectors:

Out[2]=2

Possible Issues  (3)Common pitfalls and unexpected behavior

Tube StreamMarkers can be distorted by the BoxRatios:

Out[1]=1

Carefully adjusting the BoxRatios can eliminate the tube distortion:

Out[1]=1

The colors of "Arrow" and "Arrow3D" stream markers are determined at the tip of the arrow, which can result in inconsistent colors for long arrows:

Out[1]=1
Out[2]=2
Wolfram Research (2021), StreamPlot3D, Wolfram Language function, https://reference.wolfram.com/language/ref/StreamPlot3D.html (updated 2022).
Wolfram Research (2021), StreamPlot3D, Wolfram Language function, https://reference.wolfram.com/language/ref/StreamPlot3D.html (updated 2022).

Text

Wolfram Research (2021), StreamPlot3D, Wolfram Language function, https://reference.wolfram.com/language/ref/StreamPlot3D.html (updated 2022).

Wolfram Research (2021), StreamPlot3D, Wolfram Language function, https://reference.wolfram.com/language/ref/StreamPlot3D.html (updated 2022).

CMS

Wolfram Language. 2021. "StreamPlot3D." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/StreamPlot3D.html.

Wolfram Language. 2021. "StreamPlot3D." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/StreamPlot3D.html.

APA

Wolfram Language. (2021). StreamPlot3D. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StreamPlot3D.html

Wolfram Language. (2021). StreamPlot3D. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StreamPlot3D.html

BibTeX

@misc{reference.wolfram_2025_streamplot3d, author="Wolfram Research", title="{StreamPlot3D}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/StreamPlot3D.html}", note=[Accessed: 19-June-2025 ]}

@misc{reference.wolfram_2025_streamplot3d, author="Wolfram Research", title="{StreamPlot3D}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/StreamPlot3D.html}", note=[Accessed: 19-June-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_streamplot3d, organization={Wolfram Research}, title={StreamPlot3D}, year={2022}, url={https://reference.wolfram.com/language/ref/StreamPlot3D.html}, note=[Accessed: 19-June-2025 ]}

@online{reference.wolfram_2025_streamplot3d, organization={Wolfram Research}, title={StreamPlot3D}, year={2022}, url={https://reference.wolfram.com/language/ref/StreamPlot3D.html}, note=[Accessed: 19-June-2025 ]}