I’ve been thinking about flow visualization recently, so I thought I would summarize what I know currently about the current state of making plots of vector fields in IDL.

VELOVECT routine

VELOVECT makes the standard grid of arrows representing each point in a 2D vector field. For example, try

IDL> restore, filepath('globalwinds.dat', subdir=['examples','data'])
IDL> velovect, u, v, x, y

This should produce a plot like

I think there are much better ways to visualize flow, but this is an easy way.

iVector iTool

IVECTOR is the interactive, iTools version of VELOVECT. It has an option to do wind barbs as well as arrows. It takes u, v, x, and y parameters like VELOVECT

IDL> restore, filepath('globalwinds.dat', subdir=['examples','data'])
IDL> ivector, u, v, x, y

It looks like


PARTICLE_TRACE is not a graphics routine, but computes a polygonal mesh describing the path of a particle through a 2D or 3D vector field. To see an example, try this main-level program. The example simply follows three particles and overplots the particles onto the output from VELOVECT. Run it with the following command:

IDL> .run particle_trace_example

This should produce output like

VEL routine

VEL selects random starting points and plots the particles path through a 2D vector field. For example,

IDL> restore, filepath('globalwinds.dat', subdir=['examples','data'])
IDL> vel, u, v, nvecs=1200

should give ouptut like Unfortunately, VEL does not accept graphics keywords (I had to edit the screen capture just to change the background to white) or even x and y vectors to specify the coordinate system.

PLOT_FIELD routine

PLOT_FIELD is similar to VEL, but with fewer options.

FLOW3 routine

“Draws lines” representing a 3D vector field. It does not accept graphics keywords or x-, y-, or z-axis values. I had a rough time getting any reasonable output with this routine. Here is the best I could manage with some data I had:


STREAMLINE can take the polygonal mesh output from PARTICLE_TRACE and create a ribbon along with particle’s path. For instance, given a data array and some seeds, the following will produce a ribbon specified with outVerts and outConn:

IDL> particle_trace, data, seeds, verts, conn, normals
IDL> streamline, verts, conn, normals, outVerts, outConn

I have been able to get output from this, but I haven’t been happy with it:

UPDATE: The SHOW_STREAM demo program is a better example of using STREAMLINE in combination with PARTICLE_TRACE or VECTOR_FIELD (thanks Doug Dirks for letting me know about this!). You can find it in

filename = filepath('show_stream.pro', 
                    subdir=['examples', 'doc', 'objects'])

It starts up XOBJVIEW to display the results:

Other methods

There are other methods not in IDL’s libraries for visualizing flow. The below plot, from a paper comparing the effectiveness of different vector field visualizations by Laidlawg et al., shows six common methods. GRID is the type of plot available from VELOVECT and IVECTOR. JIT is available through VEL, PLOT_FIELD, or using PARTICLE_TRACE without appropriate seeds. I wrote an article about LIC and have a slow implementation. LIT, OSTR, and GSTR are not available from the IDL library. I think OSTR would be a good technique to tackle next (after I finally get that LIC DLM completed).