GMT with custom curved arrows

I’ve been working on a program, vfplot, which creates EPS files of curved arrows (representing a 2-d vector field). The program plots only the arrows, GMT can do the rest of the work needed to make an attractive plot.

Created with

 #!/bin/sh

set -e

EXT='0.03125'
RNG="-R-$EXT/$EXT/-$EXT/$EXT"
DIM='4i/4i'
PRJ="-JX$DIM"

EPS='compose.eps'

# background scaler

GRD='/tmp/scalar-fine.grd'
grdsample grd/scalar.grd -G$GRD $RNG -I1024+n
grdimage $GRD $PRJ $RNG -Cscalar.cpt -K > $EPS
rm -f $GRD

# central cylinder

psxy $PRJ $RNG -Sc1.27i -G255 -W1p -K -O >> $EPS <<EOF
0 0
EOF

# vfplot output

psimage vfplot.eps -W$DIM -Dx0/0 -O >> $EPS

# results

psconvert -A -Tf $EPS
psconvert -A -E150 -Tg $EPS

# cleanup

rm -r $EPS

Other examples here, follow the GitLab links to inspect the GMT scripts compose.sh

1 Like

Very cool.

  • Can you make a minimal working example to dodge grdsample [ERROR]: Cannot find file grd/scalar.grd?
  • You may want to prefix the gmt commands with gmt(?).

Those files can be found on GitLab

Thanks!

GMT can also plot curved arrows via -Sm if you compute the radius required. I had plans to do that to draw flow lines.

These are curved arrow heads, which we do not do. Unf GPL’ed.

If GMT were to want some components from vfplot, I’m open to relicensing those LGPL, just ask :slight_smile:

Thanks, we may go there (they look nice), but not for now.

We do curved vector heads -Sm