PyNGL Home > Functions > Graphics routines


Creates and draws a streamline plot with the streamlines colored by a scalar field.

Available in version 1.3.0 or later.


st = Ngl.streamline_scalar(wks, u, v, data, res=None)



The identifier returned from calling Ngl.open_wks.

u, v

The U and V components of the streamlines. u and v should be two-dimensional NumPy array or NumPy masked arrays (dimensioned ny x nx).


The scalar data field for coloring the streamlines (dimensioned ny x nx).


An (optional) instance of the Resources class having PyNGL resources as attributes.


This function creates and draws a streamlines, colored by a scalar field, on the given workstation and advances the frame. Plot options can be set via the res variable.

If coordinate values for the X and Y axes are not available, then index values will be used on the axes.

If axes coordinate information is available, then set the vfXArray (sfXArray) resource to the one-dimensional NumPy array (of length nx) that represents the X axis, and vfYArray (sfYArray) to the one-dimensional NumPy array (of length ny) that represents the Y axis. Or, you can optionally send some end point values via the resources vfXCStartV (sfXCStartV), vfXCEndV (sfXCEndV), vfYCStartV (sfYCStartV), vfYCEndV (sfYCEndV) resources.

As of version 1.3.0, if u, v, and/or data are masked arrays, then any values equal to the corresponding fill values will not be plotted. If u, v, and/or data are not masked arrays and they contain missing values, then set the resources vfMissingUValueV, vfMissingVValueV, and/or sfMissingValueV to these values.

Note that PyNGL internally sets some resources for you, depending on how other resources are set. See the list of default settings for more information.

See Also

Ngl.streamline, Ngl.streamline_map, Ngl.streamline_scalar_map, Ngl.vector, Ngl.vector_scalar, Ngl.vector_map, Ngl.vector_scalar_map

StreamlinePlot resources
ContourPlot resources
VectorField resources
ScalarField resources
LabelBar resources
Title resources
TickMark resources
Transformation resources
View resources
Transform resources
PlotManager resources
Special "ngl" resources