(13) Plotting of vector fields¶

In many areas, such as fluid dynamics and elasticity, it is desirable to plot vector fields of various kinds. GMT provides a way to illustrate 2-component vector fields using the grdvector utility. The two components of the field (Cartesian or polar components) are stored in separate grid files. In this example we use grdmath to generate a surface $$z(x, y) = x \cdot \exp(-x^2 -y^2)$$ and to calculate $$\nabla z$$ by returning the x- and y-derivatives separately. We superpose the gradient vector field and the surface z and also plot the components of the gradient in separate windows. A text call to place a header finishes the plot

#!/usr/bin/env bash
#		GMT EXAMPLE 13
#
# Purpose:	Illustrate vectors and contouring
# GMT modules:	set, grdmath, grdcontour, grdvector, subplot
# Unix progs:	rm
#
gmt begin ex13