MATLAB Function Reference |

Draw stream lines from 2-D or 3-D vector data

**Syntax**

h = streamline(X,Y,Z,U,V,W,startx,starty,startz) h = streamline(U,V,W,startx,starty,startz) h = streamline(XYZ) h = streamline(X,Y,U,V,startx,starty) h = streamline(U,V,startx,starty) h = streamline(XY)

`h = streamline(...,options)`

**Description**

`h = streamline(X,Y,Z,U,V,W,startx,starty,startz)`

draws stream lines from 3-D vector data `U`

, `V`

, `W`

. The arrays `X`

, `Y`

, `Z`

define the coordinates for `U`

, `V`

, `W`

and must be monotonic and 3-D plaid (such as the data produced by `meshgrid`

). `startx`

, `starty`

, `startz`

define the starting positions of the stream lines. The section Starting Points for Stream Plots in Visualization Techniques provides more information on defining starting points.

The output argument `h`

contains a vector of line handles, one handle for each stream line.

`h = streamline(U,V,W,startx,starty,startz)`

assumes the arrays `X`

, `Y`

, and `Z`

are defined as `[X,Y,Z] = meshgrid(1:N,1:M,1:P)`

where `[M,N,P] = size(U)`

.

`h = streamline(XYZ)`

assumes `XYZ`

is a precomputed cell array of vertex arrays (as produced by `stream3`

).

`h = streamline(X,Y,U,V,startx,starty)`

draws stream lines from 2-D vector data `U`

, `V`

. The arrays `X`

, `Y`

define the coordinates for `U`

, `V`

and must be monotonic and 2-D plaid (such as the data produced by `meshgrid`

). `startx`

and `starty`

define the starting positions of the stream lines. The output argument `h`

contains a vector of line handles, one handle for each stream line.

`h = streamline(U,V,startx,starty)`

assumes the arrays `X`

and `Y`

are defined as `[X,Y] = meshgrid(1:N,1:M)`

where `[M,N] = size(U)`

.

`h = streamline(XY)`

assumes `XY`

is a precomputed cell array of vertex arrays (as produced by `stream2`

).

`streamline(...,options)`

specifies the options used when creating the stream lines. Define `options`

as a one or two element vector containing the step size or the step size and the maximum number of vertices in a stream line:

If you do not specify values, MATLAB uses the default:

**Examples**

This example draws stream lines from data representing air currents over a region of North America. Loading the `wind`

data set creates the variables `x`

, `y`

, `z`

, `u`

, `v`

, and `w`

in the MATLAB workspace.

The plane of stream lines indicates the flow of air from the west to the east (the x direction) beginning at x = 80 (which is close to the minimum value of the x coordinates). The y and z coordinate starting points are multivalued and approximately span the range of these coordinates. `meshgrid`

generates the starting positions of the stream lines.

load wind [sx,sy,sz] = meshgrid(80,20:10:50,0:5:15); h = streamline(x,y,z,u,v,w,sx,sy,sz); set(h,

`'`

Color`'`

,`'`

red`'`

) view(3)

**See Also**

`coneplot`

, `stream2`

, `stream3`

, `streamparticles`

Volume Visualization for related functions

Specifying Starting Points for Stream Plots for related information

Stream Line Plots of Vecotr Data for another example

stream3 | streamparticles |