---
title: "StreamPlot3D"
language: "en"
type: "Symbol"
summary: "StreamPlot3D[{v x, v y, v z}, {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} \\[Element] reg] takes the variables {x, y, z} to be in the geometric region reg."
keywords: 
- stream plot 3D
- stream line 3D
- stream tube 3D
- stream ribbons 3D
- streak lines 3D
- vector field plot 3D
- vector field visualization
canonical_url: "https://reference.wolfram.com/language/ref/StreamPlot3D.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Vector Visualization"
    link: "https://reference.wolfram.com/language/guide/VectorVisualization.en.md"
  - 
    title: "Function Visualization"
    link: "https://reference.wolfram.com/language/guide/FunctionVisualization.en.md"
related_functions: 
  - 
    title: "VectorPlot3D"
    link: "https://reference.wolfram.com/language/ref/VectorPlot3D.en.md"
  - 
    title: "ListStreamPlot3D"
    link: "https://reference.wolfram.com/language/ref/ListStreamPlot3D.en.md"
  - 
    title: "StreamPlot"
    link: "https://reference.wolfram.com/language/ref/StreamPlot.en.md"
  - 
    title: "SliceVectorPlot3D"
    link: "https://reference.wolfram.com/language/ref/SliceVectorPlot3D.en.md"
  - 
    title: "VectorPlot"
    link: "https://reference.wolfram.com/language/ref/VectorPlot.en.md"
  - 
    title: "NDSolve"
    link: "https://reference.wolfram.com/language/ref/NDSolve.en.md"
  - 
    title: "NDSolveValue"
    link: "https://reference.wolfram.com/language/ref/NDSolveValue.en.md"
---
# StreamPlot3D

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

* ``StreamPlot3D`` is known as a 3D stream plot or streamline plot. Besides lines, streamlines can also be displayed as tubes (stream tubes) and ribbons (stream ribbons).

* ``StreamPlot3D`` plots streamlines $\sigma _i(t)$ defined by $\sigma _i'(t)=v\left(\sigma _i(t)\right)$ and $\sigma _i(0)=p_i$, where $v(\{x,y,z\})=\left\{v_x,v_y,v_z\right\}$ and $p_i$ is an initial stream point. The streamline $\sigma _i(t)$ is the curve passing through point $p_i$, and whose tangents correspond to the vector field $v$ at each point.

* The streamlines are colored by default according to the magnitude $s$ of the vector field $\left\| \left\{v_x,v_y,v_z\right\}\right\|$.

[image]

* ``StreamPlot3D`` by default shows enough streamlines to achieve a roughly uniform density throughout the plot and shows no background scalar field.

* ``StreamPlot3D`` treats the variables ``x``, ``y`` and ``z`` as local, effectively using ``Block``.

* ``StreamPlot3D`` has attribute ``HoldAll`` and evaluates the ``vi`` etc. only after assigning specific numerical values to ``x``, ``y`` and ``z``. In some cases, it may be more efficient to use ``Evaluate`` to evaluate the ``vi`` etc. symbolically first.

* ``StreamPlot3D`` has the same options as ``Graphics3D``, with the following additions and changes:  []

|                             |                    |                                                      |
| --------------------------- | ------------------ | ---------------------------------------------------- |
| BoxRatios                   | {1, 1, 1}          | ratio of height to width                             |
| EvaluationMonitor           | None               | expression to evaluate at every function evaluation  |
| Method                      | Automatic          | methods to use for the plot                          |
| PerformanceGoal             | \$PerformanceGoal  | aspects of performance to try to optimize            |
| PlotLegends                 | None               | legends to include                                   |
| PlotRange                   | {Full, Full, Full} | range of x, y, z values to include                   |
| PlotRangePadding            | Automatic          | how much to pad the range of values                  |
| PlotTheme                   | \$PlotTheme        | overall theme for the plot                           |
| RegionBoundaryStyle         | Automatic          | how to style plot region boundaries                  |
| RegionFunction              | True&              | determine what region to include                     |
| ScalingFunctions            | None               | how to scale individual coordinates                  |
| StreamColorFunction         | Automatic          | how to color streamlines                             |
| StreamColorFunctionScaling  | True               | whether to scale the argument to StreamColorFunction |
| StreamMarkers               | Automatic          | shape to use for streams                             |
| StreamPoints                | Automatic          | the number or placement of streamlines               |
| StreamScale                 | None               | how to scale the sizes of streamlines                |
| StreamStyle                 | Automatic          | how to draw streamlines                              |
| WorkingPrecision            | MachinePrecision   | precision to use in internal computations            |

* The arguments supplied to functions in ``RegionFunction`` and ``StreamColorFunction`` are ``x, y, z, vx, vy, vz, Norm[{vx, vy, vz}]``.

* Possible settings for ``StreamMarkers`` include:

|             |               |                                  |
| ----------- | ------------- | -------------------------------- |
| [image]     | "Arrow"       | lines with 2D arrowheads         |
| [image]     | "Arrow3D"     | tubes with 3D arrowheads         |
| [image]     | "Line"        | lines                            |
| **[image]** | "Tube"        | tubes                            |
| [image]     | "Ribbon"      | flat ribbons                     |
| [image]     | "ArrowRibbon" | ribbons with built-in arrowheads |

* With ``StreamScale -> Automatic`` and "arrow" stream markers, the streamlines are split into segments to make it easier to see the direction of the streamlines.

* Possible settings for ``StreamScale`` are:

|                            |                                                       |
| -------------------------- | ----------------------------------------------------- |
| Automatic                  | automatically determine the streamline segments       |
| Full                       | show the streamline as one piece                      |
| Tiny, Small, Medium, Large | named settings for how long the segments should be    |
| {len, npts, ratio}         | use explicit specification of streamline segmentation |

* The length ``len`` of streamline segments can be one of the following forms:

|                            |                                                       |
| -------------------------- | ----------------------------------------------------- |
| Automatic                  | automatically determine the length                    |
| None                       | show the streamline as one piece                      |
| Tiny, Small, Medium, Large | use named segment lengths                             |
| s                          | use a length s that is a fraction of the graphic size |

* The number of points ``npts`` used to draw each segment can be ``Automatic`` or a specific number of points.

* The aspect ratio ``ratio`` specifies how wide the cross section of a streamline is relative to the streamline segment.

* Possible settings for ``ScalingFunctions`` include:

{Subscript[``s``, ``x``], Subscript[``s``, ``y``], Subscript[``s``, ``z``]}	scale ``x``, ``y`` and ``z`` axes

* Common built-in scaling functions ``s`` include:

|             |         |                                                     |
| ----------- | ------- | --------------------------------------------------- |
| "Log"       | [image] | log scale with automatic tick labeling              |
| "Log10"     | [image] | base-10 log scale with powers of 10 for ticks       |
| "SignedLog" | [image] | log-like scale that includes 0 and negative numbers |
| "Reverse"   | [image] | reverse the coordinate direction                    |
| "Infinite"  | [image] | infinite scale                                      |

### List of all options

|                            |                    |                                                                                    |
| -------------------------- | ------------------ | ---------------------------------------------------------------------------------- |
| AlignmentPoint             | Center             | the default point in the graphic to align with                                     |
| AspectRatio                | Automatic          | ratio of height to width                                                           |
| Axes                       | False              | whether to draw axes                                                               |
| AxesEdge                   | Automatic          | on which edges to put axes                                                         |
| AxesLabel                  | None               | axes labels                                                                        |
| AxesOrigin                 | Automatic          | where axes should cross                                                            |
| AxesStyle                  | {}                 | graphics directives to specify the style for axes                                  |
| Background                 | None               | background color for the plot                                                      |
| BaselinePosition           | Automatic          | how to align with a surrounding text baseline                                      |
| BaseStyle                  | {}                 | base style specifications for the graphic                                          |
| Boxed                      | True               | whether to draw the bounding box                                                   |
| BoxRatios                  | {1, 1, 1}          | ratio of height to width                                                           |
| BoxStyle                   | {}                 | style specifications for the box                                                   |
| ClipPlanes                 | None               | clipping planes                                                                    |
| ClipPlanesStyle            | Automatic          | style specifications for clipping planes                                           |
| ContentSelectable          | Automatic          | whether to allow contents to be selected                                           |
| ControllerLinking          | False              | when to link to external rotation controllers                                      |
| ControllerPath             | Automatic          | what external controllers to try to use                                            |
| Epilog                     | {}                 | 2D graphics primitives to be rendered after the main plot                          |
| EvaluationMonitor          | None               | expression to evaluate at every function evaluation                                |
| FaceGrids                  | None               | grid lines to draw on the bounding box                                             |
| FaceGridsStyle             | {}                 | style specifications for face grids                                                |
| FormatType                 | TraditionalForm    | default format type for text                                                       |
| ImageMargins               | 0.                 | the margins to leave around the graphic                                            |
| ImagePadding               | All                | what extra padding to allow for labels, etc.                                       |
| ImageSize                  | Automatic          | absolute size at which to render the graphic                                       |
| LabelStyle                 | {}                 | style specifications for labels                                                    |
| Lighting                   | Automatic          | simulated light sources to use                                                     |
| Method                     | Automatic          | methods to use for the plot                                                        |
| PerformanceGoal            | \$PerformanceGoal  | aspects of performance to try to optimize                                          |
| PlotLabel                  | None               | a label for the plot                                                               |
| PlotLegends                | None               | legends to include                                                                 |
| PlotRange                  | {Full, Full, Full} | range of x, y, z values to include                                                 |
| PlotRangePadding           | Automatic          | how much to pad the range of values                                                |
| PlotRegion                 | Automatic          | final display region to be filled                                                  |
| PlotTheme                  | \$PlotTheme        | overall theme for the plot                                                         |
| PreserveImageOptions       | Automatic          | whether to preserve image options when displaying new versions of the same graphic |
| Prolog                     | {}                 | 2D graphics primitives to be rendered before the main plot                         |
| RegionBoundaryStyle        | Automatic          | how to style plot region boundaries                                                |
| RegionFunction             | True&              | determine what region to include                                                   |
| RotationAction             | "Fit"              | how to render after interactive rotation                                           |
| ScalingFunctions           | None               | how to scale individual coordinates                                                |
| SphericalRegion            | Automatic          | whether to make the circumscribing sphere fit in the final display area            |
| StreamColorFunction        | Automatic          | how to color streamlines                                                           |
| StreamColorFunctionScaling | True               | whether to scale the argument to StreamColorFunction                               |
| StreamMarkers              | Automatic          | shape to use for streams                                                           |
| StreamPoints               | Automatic          | the number or placement of streamlines                                             |
| StreamScale                | None               | how to scale the sizes of streamlines                                              |
| StreamStyle                | Automatic          | how to draw streamlines                                                            |
| Ticks                      | Automatic          | specification for ticks                                                            |
| TicksStyle                 | {}                 | style specification for ticks                                                      |
| TouchscreenAutoZoom        | False              | whether to zoom to fullscreen when activated on a touchscreen                      |
| ViewAngle                  | Automatic          | angle of the field of view                                                         |
| ViewCenter                 | Automatic          | point to display at the center                                                     |
| ViewMatrix                 | Automatic          | explicit transformation matrix                                                     |
| ViewPoint                  | {1.3, -2.4, 2.}    | viewing position                                                                   |
| ViewProjection             | Automatic          | projection method for rendering objects distant from the viewer                    |
| ViewRange                  | All                | range of viewing distances to include                                              |
| ViewVector                 | Automatic          | position and direction of a simulated camera                                       |
| ViewVertical               | {0, 0, 1}          | direction to make vertical                                                         |
| WorkingPrecision           | MachinePrecision   | precision to use in internal computations                                          |

## Examples (108)

### Basic Examples (4)

Plot streamlines through a vector field in 3D:

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]

Out[1]= [image]
```

---

Use tubes to show the streamlines:

```wl
In[1]:= StreamPlot3D[{y^2, 1, x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Tube"]

Out[1]= [image]
```

---

Include a legend for the vector field magnitudes:

```wl
In[1]:= StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, PlotLegends -> Automatic]

Out[1]= [image]
```

---

Plot streamlines over an arbitrary region:

```wl
In[1]:= StreamPlot3D[{z, -x, y}, {x, y, z}∈Ball[]]

Out[1]= [image]
```

### Scope (12)

#### Sampling (3)

Specify the density of seed points for the streamlines:

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamPoints -> Coarse]

Out[1]= [image]
```

---

Specify specific seed points for the streamlines:

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamPoints -> RandomReal[{-1, 1}, {30, 3}]]

Out[1]= [image]
```

---

Plot streamlines over a specified region:

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, RegionFunction -> Function[{x, y, z}, x^2 + y^2 ≤ 1]]

Out[1]= [image]
```

#### Presentation (9)

Streamlines are drawn as lines by default:

```wl
In[1]:= StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]

Out[1]= [image]
```

Use 3D tubes for the streamlines:

```wl
In[2]:= StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Tube"]

Out[2]= [image]
```

Use flat ribbons:

```wl
In[3]:= StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Ribbon"]

Out[3]= [image]
```

---

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

```wl
In[1]:= StreamPlot3D[{z, -x, y + x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Arrow"]

Out[1]= [image]
```

Arrows on tubes:

```wl
In[2]:= StreamPlot3D[{z, -x, y + x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Arrow3D"]

Out[2]= [image]
```

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

```wl
In[3]:= StreamPlot3D[{z, -x, y + x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "ArrowRibbon"]

Out[3]= [image]
```

---

Use a single color for the streamlines:

```wl
In[1]:= StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamColorFunction -> None]

Out[1]= [image]
```

---

Use a named color gradient for the streamlines:

```wl
In[1]:= StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamColorFunction -> "DarkRainbow"]

Out[1]= [image]
```

---

Include a legend for the field magnitude:

```wl
In[1]:= StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, PlotLegends -> Automatic]

Out[1]= [image]
```

---

Use ``StreamScale`` to split streamlines into multiple shorter line segments:

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamScale -> 0.1]

Out[1]= [image]

In[2]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamScale -> 0.2]

Out[2]= [image]
```

---

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

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Arrow", StreamScale -> {Full, 20, 0.2}]

Out[1]= [image]
```

---

Use a theme:

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, PlotTheme -> "Marketing"]

Out[1]= [image]
```

---

Use a log scale for the ``x`` axis:

```wl
In[1]:= StreamPlot3D[{x, y, z}, {x, 1, 100}, {y, 1, 100}, {z, 1, 100}, ScalingFunctions -> {"Log", None, None}]

Out[1]= [image]
```

Reverse the ``y`` scale so it increases toward the bottom:

```wl
In[2]:= StreamPlot3D[{x, y, z}, {x, 1, 100}, {y, 1, 100}, {z, 1, 100}, ScalingFunctions -> {None, None, "Reverse"}]

Out[2]= [image]
```

### Options (70)

#### Axes (3)

By default, ``Axes`` are drawn:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}]

Out[1]= [image]
```

---

Use ``Axes -> False`` to turn off axes:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, Axes -> False]

Out[1]= [image]
```

---

Turn each axis on individually:

```wl
In[1]:= {StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, Axes -> {True, False, False}], StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, Axes -> {False, True, False}], StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, Axes -> {False, False, True}]}

Out[1]= [image]
```

#### AxesLabel (3)

No axes labels are drawn by default:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}]

Out[1]= [image]
```

---

Place a label on the $z$ axis:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, AxesLabel -> z]

Out[1]= [image]
```

---

Specify axes labels:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, AxesLabel -> {x, y, z}]

Out[1]= [image]
```

#### AxesOrigin (2)

The position of the axes is determined automatically:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}]

Out[1]= [image]
```

---

Specify an explicit origin for the axes:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, AxesOrigin -> {2, -1, 1}]

Out[1]= [image]
```

#### AxesStyle (4)

Change the style for the axes:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, AxesStyle -> Red]

Out[1]= [image]
```

---

Specify the style of each axis:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, AxesStyle -> {{Thick, Brown}, {Thick, Blue}, {Thick, Green}}]

Out[1]= [image]
```

---

Use different styles for the ticks and the axes:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, AxesStyle -> Green, TicksStyle -> Black]

Out[1]= [image]
```

---

Use different styles for the labels and the axes:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, AxesStyle -> Green, LabelStyle -> Black]

Out[1]= [image]
```

#### BoxRatios (2)

By default, ``BoxRatios`` is set to ``Automatic`` :

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}]

Out[1]= [image]
```

---

Make the box twice as long in the ``x`` direction:

```wl
In[1]:= StreamPlot3D[{y - z, z - x, x - y}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, BoxRatios -> {2, 1, 1}]

Out[1]= [image]
```

#### ImageSize (7)

Use named sizes, such as ``Tiny``, ``Small``, ``Medium`` and ``Large`` :

```wl
In[1]:= {StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, ImageSize -> Tiny], StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, ImageSize -> Small]}

Out[1]= [image]
```

---

Specify the width of the plot:

```wl
In[1]:= {StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, ImageSize -> 150], StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, AspectRatio -> 1.5, ImageSize -> 150]}

Out[1]= [image]
```

Specify the height of the plot:

```wl
In[2]:= {StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, ImageSize -> {Automatic, 150}], StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, AspectRatio -> 2, ImageSize -> {Automatic, 150}]}

Out[2]= [image]
```

---

Allow the width and height to be up to a certain size:

```wl
In[1]:= {StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, ImageSize -> UpTo[200]], StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, AspectRatio -> 2, ImageSize -> UpTo[200]]}

Out[1]= [image]
```

---

Specify the width and height for a graphic, padding with space if necessary:

```wl
In[1]:= StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, ImageSize -> {200, 300}, Background -> LightBlue]

Out[1]= [image]
```

Setting ``AspectRatio -> Full`` will fill the available space:

```wl
In[2]:= StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, AspectRatio -> Full, ImageSize -> {200, 300}, Background -> LightBlue]

Out[2]= [image]
```

---

Use maximum sizes for the width and height:

```wl
In[1]:= {StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, ImageSize -> {UpTo[150], UpTo[100]}], StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, AspectRatio -> 2, ImageSize -> {UpTo[150], UpTo[100]}]}

Out[1]= [image]
```

---

Use ``ImageSize -> Full`` to fill the available space in an object:

```wl
In[1]:= Framed[Pane[StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, ImageSize -> Full, Background -> LightBlue], {200, 200}]]

Out[1]= [image]
```

---

Specify the image size as a fraction of the available space:

```wl
In[1]:= Framed[Pane[StreamPlot3D[{y, -x, y - x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, AspectRatio -> Full, ImageSize -> {Scaled[0.5], Scaled[0.5]}, Background -> LightBlue], {200, 200}]]

Out[1]= [image]
```

#### PlotLegends (3)

No legends are included by default:

```wl
In[1]:= StreamPlot3D[{y z, x z, x y}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]

Out[1]= [image]
```

---

Include a legend that indicates the vector field norm:

```wl
In[1]:= StreamPlot3D[{y z, x z, x y}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, PlotLegends -> Automatic]

Out[1]= [image]
```

---

Specify the location of the legend:

```wl
In[1]:= StreamPlot3D[{y z, x z, x y}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, PlotLegends -> Placed[Automatic, Left]]

Out[1]= [image]
```

#### PlotTheme (1)

Specify a theme:

```wl
In[1]:= StreamPlot3D[{y z, 2x z, 3x y}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, PlotTheme -> "Scientific"]

Out[1]= [image]
```

#### RegionBoundaryStyle (4)

Show the region defined by a ``RegionFunction`` :

```wl
In[1]:= StreamPlot3D[{-4 x^2 y - 4 y^3 - x z, 4 x^3 + 4 x y^2 - y z, x^2 + y^2}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, RegionFunction -> (#1^2 + #2^2 + #3^2 < 1&)]

Out[1]= [image]
```

---

Use ``None`` to avoid showing the boundary:

```wl
In[1]:= StreamPlot3D[{-4 x^2 y - 4 y^3 - x z, 4 x^3 + 4 x y^2 - y z, x^2 + y^2}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, RegionFunction -> (#1^2 + #2^2 + #3^2 < 1&), RegionBoundaryStyle -> None]

Out[1]= [image]
```

---

Specify the color of the region boundary:

```wl
In[1]:= StreamPlot3D[{-4 x^2 y - 4 y^3 - x z, 4 x^3 + 4 x y^2 - y z, x^2 + y^2}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, RegionFunction -> (#1^2 + #2^2 + #3^2 < 1&), RegionBoundaryStyle -> Orange]

Out[1]= [image]
```

---

The boundaries of full rectangular regions are not shown:

```wl
In[1]:= StreamPlot3D[{-4 x^2 y - 4 y^3 - x z, 4 x^3 + 4 x y^2 - y z, x^2 + y^2}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]

Out[1]= [image]
```

#### RegionFunction (4)

Plot streamlines in a ball:

```wl
In[1]:= StreamPlot3D[{-4 x^2 y - 4 y^3 - x z, 4 x^3 + 4 x y^2 - y z, x^2 + y^2}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, RegionFunction -> (#1^2 + #2^2 + #3^2 < 1&)]

Out[1]= [image]
```

---

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

```wl
In[1]:= StreamPlot3D[{-4 x^2 y - 4 y^3 - x z, 4 x^3 + 4 x y^2 - y z, x^2 + y^2}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, RegionFunction -> (#7 > 2&)]

Out[1]= [image]
```

---

Region functions depend, in general, on seven arguments:

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, RegionFunction -> Function[{x, y, z, vx, vy, vz, n}, vx vy > 0]]

Out[1]= [image]
```

---

Use ``RegionBoundaryStyle -> None`` to avoid showing the boundary:

```wl
In[1]:= StreamPlot3D[{-4 x^2 y - 4 y^3 - x z, 4 x^3 + 4 x y^2 - y z, x^2 + y^2}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, RegionFunction -> (#1^2 + #2^2 + #3^2 < 1&), RegionBoundaryStyle -> None]

Out[1]= [image]
```

#### ScalingFunctions (1)

Use a log scale for the ``x`` axis:

```wl
In[1]:= StreamPlot3D[{x, y, z}, {x, 1, 100}, {y, 1, 10}, {z, 1, 10}, ScalingFunctions -> {"Log", None, None}]

Out[1]= [image]
```

Reverse the ``y`` scale so it increases toward the bottom:

```wl
In[2]:= StreamPlot3D[{x, y, z}, {x, 1, 100}, {y, 1, 100}, {z, 1, 100}, ScalingFunctions -> {None, None, "Reverse"}]

Out[2]= [image]
```

#### StreamColorFunction (4)

Color the streams by their norm:

```wl
In[1]:= StreamPlot3D[{x, 2y, 3z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamColorFunction -> Hue]

Out[1]= [image]
```

---

Use any named color gradient from ``ColorData`` :

```wl
In[1]:= StreamPlot3D[{x, 2y, 3z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamColorFunction -> "Rainbow"]

Out[1]= [image]
```

---

Color the streamlines according to their ``x`` value:

```wl
In[1]:= StreamPlot3D[{x, 2y, 3z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamColorFunction -> Function[{x, y, z, vx, vy, vz, n}, Hue[x]]]

Out[1]= [image]
```

---

Use ``StreamColorFunctionScaling -> False`` to get unscaled values:

```wl
In[1]:= StreamPlot3D[{x, 2y, 3z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamColorFunction -> "Rainbow", StreamColorFunctionScaling -> False]

Out[1]= [image]
```

#### StreamColorFunctionScaling (2)

By default, scaled values are used:

```wl
In[1]:= StreamPlot3D[{y, -x, 10z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamColorFunction -> "Pastel", PlotLegends -> Automatic]

Out[1]= [image]
```

---

Use ``StreamColorFunctionScaling -> False`` to get unscaled values:

```wl
In[1]:= StreamPlot3D[{y, -x, 10z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamColorFunction -> "BlueGreenYellow", PlotLegends -> Automatic, StreamColorFunctionScaling -> False]

Out[1]= [image]
```

#### StreamMarkers (5)

By default, lines are used:

```wl
In[1]:= StreamPlot3D[{-4 x^2 y - 4 y^3 - x z, 4 x^3 + 4 x y^2 - y z, x^2 + y^2}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]

Out[1]= [image]
```

---

Draw the streamlines as tubes:

```wl
In[1]:= StreamPlot3D[IconizedObject[«field»], IconizedObject[«vars»], StreamMarkers -> "Tube"]

Out[1]= [image]
```

Draw them as flat ribbons:

```wl
In[2]:= StreamPlot3D[IconizedObject[«field»], IconizedObject[«vars»], StreamMarkers -> "Ribbon"]

Out[2]= [image]
```

---

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

```wl
In[1]:= StreamPlot3D[IconizedObject[«field»], IconizedObject[«vars»], StreamMarkers -> "Arrow"]

Out[1]= [image]
```

Use 3D arrowheads on tubes:

```wl
In[2]:= StreamPlot3D[IconizedObject[«field»], IconizedObject[«vars»], StreamMarkers -> "Arrow3D"]

Out[2]= [image]
```

Use directional ribbons:

```wl
In[3]:= StreamPlot3D[IconizedObject[«field»], IconizedObject[«vars»], StreamMarkers -> "ArrowRibbon"]

Out[3]= [image]
```

---

Make segmented markers continuous:

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Arrow3D", StreamScale -> Full]

Out[1]= [image]
```

---

Break continuous markers into segments:

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Ribbon", StreamScale -> 0.1]

Out[1]= [image]
```

#### StreamPoints (4)

Use automatically determined stream points to seed the curves:

```wl
In[1]:= StreamPlot3D[{y^2, 1, x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]

Out[1]= [image]
```

---

Specify a maximum number of streamlines:

```wl
In[1]:= StreamPlot3D[{y^2, 1, x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamPoints -> 25]

Out[1]= [image]
```

---

Give specific seed points for the streams:

```wl
In[1]:= StreamPlot3D[{y^2, 1, x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamPoints -> RandomReal[{-1, 1}, {20, 3}]]

Out[1]= [image]
```

---

Use coarsely spaced streamlines:

```wl
In[1]:= StreamPlot3D[{y^2, 1, x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamPoints -> Coarse]

Out[1]= [image]
```

Use more finely spaced streamlines:

```wl
In[2]:= StreamPlot3D[{y^2, 1, x}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamPoints -> Fine]

Out[2]= [image]
```

#### StreamScale (9)

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

```wl
In[1]:= StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Arrow"]

Out[1]= [image]
```

---

Modify the lengths of the segments:

```wl
In[1]:= StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Arrow", StreamScale -> 0.2]

Out[1]= [image]
```

---

Specify the number of sample points in each segment:

```wl
In[1]:= StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Arrow", StreamScale -> {0.2, 2}]

Out[1]= [image]
```

---

Modify the aspect ratios for the stream markers:

```wl
In[1]:= StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Arrow", StreamScale -> {0.2, 2, 0.2}]

Out[1]= [image]
```

---

Make segmented markers continuous:

```wl
In[1]:= StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Arrow", StreamScale -> Full]

Out[1]= [image]
```

---

Break continuous markers into segments:

```wl
In[1]:= StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Ribbon", StreamScale -> 0.2]

Out[1]= [image]
```

---

The aspect ratio controls the thickness of ribbons and tubes:

```wl
In[1]:= {StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Ribbon", StreamScale -> {Automatic, Automatic, 0.05}], StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Tube", StreamScale -> {Automatic, Automatic, 0.05}]}

Out[1]= {[image], [image]}
```

Increase the width of the ribbons and tubes:

```wl
In[2]:= {StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Ribbon", StreamScale -> {Automatic, Automatic, 0.1}], StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Tube", StreamScale -> {Automatic, Automatic, 0.1}]}

Out[2]= {[image], [image]}
```

---

The aspect ratio controls the sizes of arrowheads:

```wl
In[1]:= {StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Arrow", StreamScale -> {Automatic, Automatic, 0.15}], StreamPlot3D[{1, y, ArcTan[x]}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Arrow", StreamScale -> {Automatic, Automatic, 0.2}]}

Out[1]= [image]
```

---

Control the number of points in each segment:

```wl
In[1]:= {StreamPlot3D[{-4 x^2 y - 4 y^3 - x z, 4 x^3 + 4 x y^2 - y z, x^2 + y^2}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamScale -> {0.5, 5}, ...], StreamPlot3D[{-4 x^2 y - 4 y^3 - x z, 4 x^3 + 4 x y^2 - y z, x^2 + y^2}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamScale -> {0.5, 20}, ...]}

Out[1]= {[image], [image]}
```

#### StreamStyle (3)

Change the appearance of the streamlines:

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamStyle -> Thickness[0.02]]

Out[1]= [image]
```

---

``StreamColorFunction`` takes precedence over ``StreamStyle`` :

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamStyle -> Directive[Red, Dashing[{0.1, 0.01}]]]

Out[1]= [image]
```

---

Use ``StreamColorFunction -> None`` to specify a streamline color with ``StreamStyle`` :

```wl
In[1]:= StreamPlot3D[{x, y, 1}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamStyle -> Directive[Red, Dashing[{0.1, 0.01}]], StreamColorFunction -> None]

Out[1]= [image]
```

#### Ticks (6)

Ticks are placed automatically in each plot:

```wl
In[1]:= StreamPlot3D[{x, y, 1 / y}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]

Out[1]= [image]
```

---

Use ``Ticks -> None`` to not draw any tick marks:

```wl
In[1]:= StreamPlot3D[{x, y, 1 / y}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, Ticks -> None]

Out[1]= [image]
```

---

Place tick marks at specific positions:

```wl
In[1]:= StreamPlot3D[{x, y, 1 / y}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, Ticks -> {{-1.5, 0, 1.5}, {-1.5, 0, 1.5}, {-1.5, 0, 1.5}}]

Out[1]= [image]
```

---

Draw tick marks at the specified positions with the specified labels:

```wl
In[1]:= StreamPlot3D[{x, y, 1 / y}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, Ticks -> {{{-1.5, -a}, {0, 0}, {1.5, a}}, {{-1.5, -a}, {0, 0}, {1.5, a}}, {{-1.5, -a}, {0, 0}, {1.5, a}}}]

Out[1]= [image]
```

---

Specify tick marks with scaled lengths:

```wl
In[1]:= StreamPlot3D[{x, y, 1 / y}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, Ticks -> {{{-1.5, -a, .1}, {0, 0, .1}, {1.5, a, .1}}, {{-1.5, -a, .05}, {0, 0, .05}, {1.5, a, .05}}, {{-1.5, -a, .15}, {0, 0, .15}, {1.5, a, .15}}}]

Out[1]= [image]
```

---

Customize each tick with position, length, labeling and styling:

```wl
In[1]:= StreamPlot3D[{x, y, 1 / y}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, Ticks -> {{{-1.5, -a, .1, Directive[Red, Dashed, Thick]}, {0, 0, .1, Directive[Red, Dashed]}, {1.5, a, .1, Directive[Red]}}, {{-1.5, -a, .05, Directive[Black, Dashed, Thick]}, {0, 0, .05, Directive[Black, Dashed]}, {1.5, a, .05, Directive[Black]}}, {{-1.5, -a, .15, Directive[Darker@Green, Dashed, Thick]}, {0, 0, .15, Directive[Darker@Green, Dashed]}, {1.5, a, .15, Directive[Darker@Green]}}}]

Out[1]= [image]
```

#### TicksStyle (3)

By default, the ticks and tick labels use the same styles as the axis:

```wl
In[1]:= StreamPlot3D[{x, y, 1 / y}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, AxesStyle -> Directive[Bold, Red]]

Out[1]= [image]
```

---

Specify overall tick style, including the tick labels:

```wl
In[1]:= StreamPlot3D[{x, y, 1 / y}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, TicksStyle -> Directive[Bold, Red]]

Out[1]= [image]
```

---

Specify tick style for each of the axes:

```wl
In[1]:= StreamPlot3D[{x, y, 1 / y}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, TicksStyle -> {Directive[Black, Bold], Directive[Bold, Red], Directive[Bold, Blue]}]

Out[1]= [image]
```

### Applications (10)

#### Basic Applications (1)

Consider a vector differential equation $x'=f(x)$ where $f(x)=\text{If}[\| x\| \leq 1,x,\{1,0,0\}]$ is defined piecewise.

Visualize solutions of $x'=f(x)$ using seed points for the streamlines that are inside the unit sphere:

```wl
In[1]:= StreamPlot3D[If[x^2 + y^2 + z^2 < 1, {x, y, z}, {1, 0, 0}], {x, -1.2, 1.2}, {y, -1.2, 1.2}, {z, -1.2, 1.2}, StreamPoints -> 0.5SpherePoints[50]]

Out[1]= [image]
```

#### Fluid Flow (3)

Consider [Stokes flow](https://en.wikipedia.org/wiki/Stokes_flow) for a point force of the form $F \delta (x,y,z)$, where $F$ is a constant vector and $\delta (x,y,z)$ is a Dirac delta function. For example, a force pointing down:

```wl
In[1]:= F = {0, 0, -1};
```

Define the fluid velocity vector $u$, the pressure $p$ and the viscosity $\mu$ :

```wl
In[2]:=
vars = {x, y, z};
μ = 1;
u = (1/8π μ)Table[Sum[( (vars[[i]]vars[[j]]/(vars.vars)^3 / 2) + (IdentityMatrix[3][[i, j]]/Sqrt[vars.vars]))F[[j]], {j, 1, 3}], {i, 1, 3}];
p = (1/4π)Sum[(vars[[j]]F[[j]]/(vars.vars)^3 / 2), {j, 1, 3}];
```

Confirm that the equations for Stokes flow are satisfied so that $\nabla \cdot u=0$ and $\nabla p=\mu \nabla ^2u+F \delta (x,y,z)$ :

```wl
In[3]:= {Div[u, vars] == 0, Grad[p, vars] == μ Laplacian[u, vars]}//Simplify

Out[3]= {True, True}
```

Plot streamlines for the flow:

```wl
In[4]:= StreamPlot3D[u, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, StreamMarkers -> "Arrow3D", PlotLegends -> Automatic]

Out[4]= [image]
```

---

Visualize Stokes flow around a unit sphere. Define the fluid velocity vector $u$, the pressure $p$, the viscosity $\mu$ and the far-field fluid speed $U$ :

```wl
In[1]:=
vars = {x, y, z};
μ = 1;
U = 1;
u = {U, 0, 0} - (3/4)(x (U vars/(vars.vars)^3 / 2) + ({U, 0, 0}/Sqrt[vars.vars])) - (1/4)(({U, 0, 0}/(vars.vars)^3 / 2) - (3U x vars/(vars.vars)^5 / 2));
p = -(3μ x/2(vars.vars)^3 / 2);
```

Confirm that the equations for Stokes flow are satisfied so that $\nabla \cdot u=0$ and $\nabla p=\mu \nabla ^2u$ :

```wl
In[2]:= {Div[u, vars] == 0, Grad[p, vars] == μ Laplacian[u, vars]}//Simplify

Out[2]= {True, True}
```

Plot streamlines for the flow:

```wl
In[3]:= Show[StreamPlot3D[u, {x, -4, 4}, {y, -2, 2}, {z, -2, 2}, PlotLegends -> Automatic, StreamMarkers -> "Arrow", StreamPoints -> Flatten[Table[{-3, y, z}, {y, -1.75, 1.75, 0.5}, {z, -1.75, 1.75, 0.5}], 1]], Graphics3D[{Yellow, Sphere[]}], BoxRatios -> {2, 1, 1}]

Out[3]= [image]
```

Plot the pressure for the flow:

```wl
In[4]:= DensityPlot3D[p, {x, -4, 4}, {y, -2, 2}, {z, -2, 2}, PlotLegends -> Automatic, RegionFunction -> Function[{x, y, z}, x^2 + y^2 + z^2 > 1], BoxRatios -> {2, 1, 1}]

Out[4]= [image]
```

---

Specify the Navier–Stokes equations for a fluid through a pipe with a bulge:

```wl
In[1]:=
velocities = {u[x, y, z], v[x, y, z], w[x, y, z]};
navierstokes = { 
    Inactive[
       Div][(-μ Inactive[Grad][u[x, y, z], {x, y, z}]), {x, y, 
       z}] + ρ  * 
      velocities.Inactive[Grad][u[x, y, z], {x, y, z}] + 
p^(1, 0, 0)[x, y, z], 
    Inactive[
       Div][(-μ Inactive[Grad][v[x, y, z], {x, y, z}]), {x, y, 
       z}] + ρ  * 
      velocities.Inactive[Grad][v[x, y, z], {x, y, z}] + 
p^(0, 1, 0)[x, y, z], 
    Inactive[
       Div][(-μ Inactive[Grad][w[x, y, z], {x, y, z}]), {x, y, 
       z}] + ρ  * 
      velocities.Inactive[Grad][w[x, y, z], {x, y, z}] + 
p^(0, 0, 1)[x, y, z], 
    
u^(1, 0, 0)[x, y, z] + v^(0, 1, 0)[x, y, z] + w^(0, 0, 1)[x, y, z]} /. {μ -> 10 ^ -3, ρ -> 1};
```

Specify the geometry for the flow:

```wl
In[2]:=
Ω = RegionUnion[Ball[], Cylinder[{{-2, 0, 0}, {2, 0, 0}}, 1 / 2]];
RegionPlot3D[Ω]

Out[2]= [image]
```

Specify the boundary conditions for flow from left to right:

```wl
In[3]:=
inflowBC = DirichletCondition[{u[x, y, z] == 0.2, v[x, y, z] == 0, w[x, y, z] == 0}, x == -2];
outflowBC = DirichletCondition[p[x, y, z] == 0, x == 2];
wallBC = DirichletCondition[{u[x, y, z] == 0, v[x, y, z] == 0, w[x, y, z] == 0}, -2 < x < 2];
bcs = {inflowBC, outflowBC, wallBC};
```

Solve for the flow velocities and pressure:

```wl
In[4]:= {uVel, vVel, wVel, pressure} = NDSolveValue[{navierstokes == {0, 0, 0, 0}, bcs}, {u, v, w, p}, {x, y, z}∈Ω, Method -> {"FiniteElement", "InterpolationOrder" -> {u -> 2, v -> 2, w -> 2, p -> 1}, "MeshOptions" -> {"MaxCellMeasure" -> 0.01}}];
```

Specify seed points for the streamlines:

```wl
In[5]:= sp = Prepend[#, 0]& /@ Flatten[Table[CirclePoints[r, 10], {r, {0.3, 0.5, 0.7, 0.9}}], 1];
```

Plot the streamlines for the flow:

```wl
In[6]:= StreamPlot3D[{uVel[x, y, z], vVel[x, y, z], wVel[x, y, z]}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, RegionFunction -> Function[{x, y, z}, {x, y, z}∈Ω], StreamPoints -> sp, BoxRatios -> {2, 1, 1}, Method -> {"IntegrationLimits" -> 100}, StreamMarkers -> "Arrow", StreamScale -> {0.05, Automatic, 0.07}, ImageSize -> Medium]

Out[6]= [image]
```

#### Electrical Systems (1)

Visualize electric field lines for a dipole:

```wl
In[1]:= StreamPlot3D[({x, y, z - 1}/Norm[{x, y, z - 1}]^3) - ({x, y, z + 1}/Norm[{x, y, z + 1}]^3), {x, -3, 3}, {y, -3, 3}, {z, -3, 3}]

Out[1]= [image]
```

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

```wl
In[2]:= StreamPlot3D[({x, y, z - 1}/Norm[{x, y, z - 1}]^3) - ({x, y, z + 1}/Norm[{x, y, z + 1}]^3), {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, RegionFunction -> (#7 < 5&), RegionBoundaryStyle -> None, PlotLegends -> Automatic]

Out[2]= [image]
```

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

```wl
In[3]:= Show[StreamPlot3D[({x, y, z - 1}/Norm[{x, y, z - 1}]^3) - ({x, y, z + 1}/Norm[{x, y, z + 1}]^3), {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, RegionFunction -> (#7 < 5&), RegionBoundaryStyle -> None, PlotLegends -> Automatic], Graphics3D[{Red, Sphere[{0, 0, 1}, 0.2], Black, Sphere[{0, 0, -1}, 0.2]}]]

Out[3]= [image]
```

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:

```wl
In[4]:= Show[StreamPlot3D[({x, y, z - 1}/Norm[{x, y, z - 1}]^3) - ({x, y, z + 1}/Norm[{x, y, z + 1}]^3), {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, RegionFunction -> (#7 < 5&), RegionBoundaryStyle -> None, PlotLegends -> Automatic, StreamMarkers -> "Arrow3D"], Graphics3D[{Red, Sphere[{0, 0, 1}, 0.2], Black, Sphere[{0, 0, -1}, 0.2]}]]

Out[4]= [image]
```

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

```wl
In[5]:= Show[StreamPlot3D[({x, y, z - 1}/Norm[{x, y, z - 1}]^3) - ({x, y, z + 1}/Norm[{x, y, z + 1}]^3), {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, RegionFunction -> (0.01 < #7 < 5&), RegionBoundaryStyle -> None, StreamColorFunction -> (Blend[{GrayLevel[0], GrayLevel[1], RGBColor[1, 0, 0]}, #3]&), StreamMarkers -> "Arrow"], Graphics3D[{Red, Sphere[{0, 0, 1}, 0.2], Black, Sphere[{0, 0, -1}, 0.2]}]]

Out[5]= [image]
```

#### Miscellaneous (5)

Lorenz attractor:

```wl
In[1]:= StreamPlot3D[{10(y - x), x(28 - z) - y, x y - (8/3) z}, {x, -30, 30}, {y, -30, 30}, {z, 0, 50}, StreamPoints -> {{1, 1, 1}}]

Out[1]= [image]
```

---

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

```wl
In[1]:= StreamPlot3D[{1, 2x, 3x^2}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "ArrowRibbon", StreamPoints -> {{0, 0, 0}}, ViewPoint -> {-1.3, 2.4, 2}]

Out[1]= [image]
```

---

Visualize solutions of differential equations on manifolds:

```wl
In[1]:= StreamPlot3D[{-y, x, x^2 - y^2}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, StreamPoints -> Table[{r, 0, 0}, {r, 0, 2, 0.2}]]

Out[1]= [image]
```

---

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

```wl
In[1]:= StreamPlot3D[{1 - y^2 - z^2, 0, 0}, {x, -2, 2}, {y, -1, 1}, {z, -1, 1}, BoxRatios -> {2, 1, 1}, PlotLegends -> Automatic, RegionFunction -> Function[{x, y, z}, y^2 + z^2 ≤ 1], StreamMarkers -> "Arrow", StreamPoints -> Flatten[Table[Prepend[#, 0]& /@ CirclePoints[r, 10], {r, 0.1, 1, 0.1}], 1]]

Out[1]= [image]
```

---

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

```wl
In[1]:=
moments = {1, 2, 3};
StreamPlot3D[Evaluate[(⁠|     |     |     |
| --- | --- | --- |
| 0   | -x3 | x2  |
| x3  | 0   | -x1 |
| -x2 | x1  | 0   |⁠).({x1, x2, x3}/moments)], {x1, -1, 1}, {x2, -1, 1}, {x3, -1, 1}, StreamPoints -> SpherePoints[40]]

Out[1]= [image]
```

### Properties & Relations (9)

Use ``VectorPlot3D`` to visualize a field with discrete arrows:

```wl
In[1]:= VectorPlot3D[{z, -x, y}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]

Out[1]= [image]
```

Use ``ListStreamPlot3D`` or ``ListVectorPlot3D`` to generate plots based on data:

```wl
In[2]:= data = Table[{z, -x, y}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}];

In[3]:= {ListStreamPlot3D[data], ListVectorPlot3D[data]}

Out[3]= [image]
```

---

Use ``StreamPlot`` to plot streamlines of 2D vector fields:

```wl
In[1]:= StreamPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -3, 3}, {y, -3, 3}]

Out[1]= [image]
```

Use ``VectorPlot`` to plot with vectors instead of streamlines:

```wl
In[2]:= VectorPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -3, 3}, {y, -3, 3}]

Out[2]= [image]
```

Generate plots based on data:

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

In[4]:= {ListStreamPlot[data], ListVectorPlot[data]}

Out[4]= {[image], [image]}
```

---

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

```wl
In[1]:= StreamDensityPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -3, 3}, {y, -3, 3}]

Out[1]= [image]
```

Use ``VectorDensityPlot`` to plot with arrows instead of streamlines:

```wl
In[2]:= VectorDensityPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -3, 3}, {y, -3, 3}]

Out[2]= [image]
```

Generate plots based on data:

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

In[4]:= {ListStreamDensityPlot[data], ListVectorDensityPlot[data]}

Out[4]= [image]
```

---

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

```wl
In[1]:= LineIntegralConvolutionPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -3, 3}, {y, -3, 3}]

Out[1]= [image]
```

---

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

```wl
In[1]:= VectorDisplacementPlot[{y, x - x^3}, {x, y}∈Disk[], VectorPoints -> Automatic]

Out[1]= [image]
```

Use ``ListVectorDisplacementPlot`` to visualize the same deformation based on data:

```wl
In[2]:= data = Table[{{x, y} = RandomReal[{-1, 1}, {2}], {y, x - x ^ 3}}, {300}];

In[3]:= ListVectorDisplacementPlot[data, Disk[], VectorPoints -> Automatic]

Out[3]= [image]
```

---

Plot vectors along surfaces with ``SliceVectorPlot3D`` :

```wl
In[1]:= SliceVectorPlot3D[{x, y, z}, "CenterPlanes", {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]

Out[1]= [image]

In[2]:= data = Table[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}];

In[3]:= ListSliceVectorPlot3D[data, "CenterPlanes"]

Out[3]= [image]
```

---

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

```wl
In[1]:= VectorDisplacementPlot3D[{y, x, -z}, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, VectorPoints -> "Boundary"]

Out[1]= [image]
```

Use ``ListVectorDisplacementPlot3D`` to visualize the same deformation based on data:

```wl
In[2]:= data = Table[{{x, y, z} = RandomReal[{0, 1}, {3}], {y, x, -z}}, {300}];

In[3]:= ListVectorDisplacementPlot3D[data, Cuboid[], VectorPoints -> "Boundary"]

Out[3]= [image]
```

---

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

```wl
In[1]:= {ComplexVectorPlot[Sin[3z], {z, 2}], ComplexStreamPlot[Sin[3z], {z, 2}]}

Out[1]= [image]
```

---

Use ``GeoVectorPlot`` to plot vectors on a map:

```wl
In[1]:=
GeoVectorPlot[GeoVector[GeoPosition[CompressedData["«6488»"]] -> 
  {{0.5706379232485146, Quantity[354.01686143622794, "AngularDegrees"]}, 
   {0.48751317221734114, Quantity[327.18610724051325, "AngularDegrees"]}, 
   {0.42407845478418604, Quantity[199.859344783 ... 904, "AngularDegrees"]}, 
   {0.9366099079317551, Quantity[357.70482317743733, "AngularDegrees"]}, 
   {0.8256817194791912, Quantity[242.07227508889662, "AngularDegrees"]}, 
   {0.2661401145642981, Quantity[152.90003252279325, "AngularDegrees"]}}]]

Out[1]= [image]
```

Use ``GeoStreamPlot`` to plot streamlines instead of vectors:

```wl
In[2]:=
GeoStreamPlot[GeoVector[GeoPosition[CompressedData["«6488»"]] -> 
  {{0.5706379232485146, Quantity[354.01686143622794, "AngularDegrees"]}, 
   {0.48751317221734114, Quantity[327.18610724051325, "AngularDegrees"]}, 
   {0.42407845478418604, Quantity[199.859344783 ... 904, "AngularDegrees"]}, 
   {0.9366099079317551, Quantity[357.70482317743733, "AngularDegrees"]}, 
   {0.8256817194791912, Quantity[242.07227508889662, "AngularDegrees"]}, 
   {0.2661401145642981, Quantity[152.90003252279325, "AngularDegrees"]}}]]

Out[2]= [image]
```

### Possible Issues (3)

Tube ``StreamMarkers`` can be distorted by the ``BoxRatios`` :

```wl
In[1]:= StreamPlot3D[{2, -10 z - x y, 10 y - x z}, {x, -2π, 2π}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Tube"]

Out[1]= [image]
```

---

Carefully adjusting the ``BoxRatios`` can eliminate the tube distortion:

```wl
In[1]:= StreamPlot3D[{2, -10 z - x y, 10 y - x z}, {x, -2π, 2π}, {y, -1, 1}, {z, -1, 1}, StreamMarkers -> "Tube", BoxRatios -> {2π, 1, 1}]

Out[1]= [image]
```

---

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:

```wl
In[1]:= StreamPlot3D[{ArcTan[z], y, -x}, {x, -5, 5}, {y, -5, 5}, {z, -5, 5}]

Out[1]= [image]

In[2]:= StreamPlot3D[{ArcTan[z], y, -x}, {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, StreamMarkers -> "Arrow3D", StreamScale -> Full]

Out[2]= [image]
```

## See Also

* [`VectorPlot3D`](https://reference.wolfram.com/language/ref/VectorPlot3D.en.md)
* [`ListStreamPlot3D`](https://reference.wolfram.com/language/ref/ListStreamPlot3D.en.md)
* [`StreamPlot`](https://reference.wolfram.com/language/ref/StreamPlot.en.md)
* [`SliceVectorPlot3D`](https://reference.wolfram.com/language/ref/SliceVectorPlot3D.en.md)
* [`VectorPlot`](https://reference.wolfram.com/language/ref/VectorPlot.en.md)
* [`NDSolve`](https://reference.wolfram.com/language/ref/NDSolve.en.md)
* [`NDSolveValue`](https://reference.wolfram.com/language/ref/NDSolveValue.en.md)

## Related Guides

* [Vector Visualization](https://reference.wolfram.com/language/guide/VectorVisualization.en.md)
* [Function Visualization](https://reference.wolfram.com/language/guide/FunctionVisualization.en.md)

## History

* [Introduced in 2021 (12.3)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn123.en.md) \| [Updated in 2022 (13.1)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn131.en.md)