Plot z = f(x,y) anomalies along tracks


gmt wiggle [ table ] -Jparameters -Rwest/east/south/north[/zmin/zmax][+r][+uunit] -Zscale [ -A[azimuth] ] [ -B[p|s]parameters ] [ -Ccenter ] [ -Drefpoint ] [ -Fpanel ] [ -Gfill[+n][+p] ] [ -Ifix_az ] [ -Tpen ] [ -U[stamp] ] [ -V[level] ] [ -Wpen ] [ -X[a|c|f|r][xshift] ] [ -Y[a|c|f|r][yshift] ] [ -bibinary ] [ -dinodata[+ccol] ] [ -eregexp ] [ -fflags ] [ -ggaps ] [ -hheaders ] [ -iflags ] [ -pflags ] [ -qiflags ] [ -ttransp ] [ -wflags ] [ -:[i|o] ] [ --PAR=value ]


Reads (x,y,z) triplets from files [or standard input] and plots z as a function of distance along track. This means that two consecutive (x,y) points define the local distance axis, and the local z axis is then perpendicular to the distance axis, forming a right-handed coordinate system. The user may set a preferred positive anomaly plot direction, and if the positive normal is outside the ±90 degree window around the preferred direction, then 180 degrees are added to the direction. Either the positive or the negative wiggle (or both) may be shaded.

Required Arguments


One or more ASCII (or binary, see -bi[ncols][type]) data table file(s) holding a number of data columns. If no tables are given then we read from standard input.


Specify the projection. (See full description) (See technical reference) (See projections table).


Specify the region of interest. Note: If using modern mode and -R is not provided, the region will be set based on previous plotting commands. If this is the first plotting command in the modern mode levels and -R is not provided, the region will be automatically determined based on the data in table (equivalent to using -Ra). (See full description) (See technical reference).

For perspective view -p, optionally append /zmin/zmax. (more …)


Gives anomaly scale in data-units/distance-unit. Append c, i, or p to indicate the distance unit (cm, inch, or point); if no unit is given we use the default unit that is controlled by PROJ_LENGTH_UNIT.

Optional Arguments


Sets the preferred positive azimuth. Positive wiggles will “gravitate” towards that direction, i.e., azimuths of the normal direction to the track will be flipped into the ±90 degree window centered on azimuth and that defines the positive wiggle side. If no azimuth is given the no preferred azimuth is enforced. Default is -A0.


Set map boundary frame and axes attributes. (See full description) (See technical reference).


Subtract center from the data set before plotting [0].


Defines the reference point on the map for the vertical scale bar using one of four coordinate systems:

Append +w followed by the length or the scale bar in data (z) units. By default, the anchor point on the scale is assumed to be the middle left corner (ML), but this can be changed by appending +j followed by a 2-char justification code justify (see text). Note: If -Dj is used then justify defaults to the same as refpoint, if -DJ is used then justify defaults to the mirror opposite of refpoint. Consequently, -DJ is used to place a scale outside the map frame while -Dj is used to place it inside the frame. Move scale label to the left side with +al [Default is to the right of the scale]. Append +l to set the z unit label that is used in the scale label [no unit]. The FONT_ANNOT_PRIMARY is used for the font setting, while MAP_TICK_PEN_PRIMARY is used to draw the scale bar.


Without further options, draws a rectangular border around the vertical scale bar using MAP_FRAME_PEN. The following modifiers can be appended to -F, with additional explanation and examples provided in the The background panel cookbook section:

  • +c - Set clearance where clearance is either gap, xgap/ygap, or lgap/rgap/bgap/tgap. Here, gap gives a uniform clearance, xgap/ygap give separate clearances in the x- and y- directions, and lgap/rgap/bgap/tgap give individual clearances between the map embellishment and the border for each side.

  • +g - Give fill to fill the box with a color specified by fill [default is no fill].

  • +i - Draw a secondary, inner border border outline [[gap/]pen]. Optionally, append the gap between the inner and outer border and the pen for the inner border [default is a uniform gap between borders of 2p and the MAP_DEFAULT_PEN].

  • +p - append pen to specify different pen attributes for the box outline.

  • +r - Draw a rounded rectangular borders instead of sharp with a corner radius set by radius (append units) [defaults is 6p].

  • +s - Place an offset background shaded region behind the box. Here, dx/dy indicates the shift relative to the foreground frame [default is 4p/-4p] and shade sets the fill style to use for shading [default is gray50].

-Gfill[+n][+p] (more …)

Set fill shade, color or pattern for positive and/or negative wiggles [Default is no fill]. Optionally, append +p to fill positive areas (this is the default behavior). Append +n to fill negative areas. Append +n+p to fill both positive and negative areas with the same fill. Note: You will need to repeat the -G option to select different fills for the positive and negative wiggles.


Set a fixed azimuth projection for wiggles [Default uses track azimuth, but see -A]. With this option, the calculated track-normal azimuths are overridden by fix_az.


Draw track [Default is no track]. Append pen attributes to use [Defaults: width = 0.25p, color = black, style = solid].


Draw GMT time stamp logo on plot. (See full description) (See technical reference).


Select verbosity level [w]. (See full description) (See technical reference).


Specify outline pen attributes [Default is no outline].


Shift plot origin. (See full description) (See technical reference).


Shift plot origin. (See full description) (See technical reference).

-birecord[+b|l] (more …)

Select native binary format for primary table input. [Default is 3 input columns].

-dinodata[+ccol] (more …)

Replace input columns that equal nodata with NaN.

-e[~]“pattern” | -e[~]/regexp/[i] (more …)

Only accept data records that match the given pattern.

-f[i|o]colinfo (more …)

Specify data types of input and/or output columns.

-gx|y|z|d|X|Y|Dgap[u][+a][+ccol][+n|p] (more …)

Determine data gaps and line breaks.

-h[i|o][n][+c][+d][+msegheader][+rremark][+ttitle] (more …)

Skip or produce header record(s).

-icols[+l][+ddivisor][+sscale|d|k][+ooffset][,][,t[word]] (more …)

Select input columns and transformations (0 is first column, t is trailing text, append word to read one word only).

-p[x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0] (more …)

Select perspective view.

-qi[~]rows|limits[+ccol][+a|t|s] (more …)

Select input rows or data limit(s) [default is all rows].

-ttransp[/transp2] (more …)

Set transparency level(s) in percent.

-wy|a|w|d|h|m|s|cperiod[/phase][+ccol] (more …)

Convert an input coordinate to a cyclical coordinate.

-:[i|o] (more …)

Swap 1st and 2nd column on input and/or output.

-^ or just -

Print a short message about the syntax of the command, then exit (Note: on Windows just use -).

-+ or just +

Print an extensive usage (help) message, including the explanation of any module-specific option (but not the GMT common options), then exit.

-? or no arguments

Print a complete usage (help) message, including the explanation of all options, then exit.


Temporarily override a GMT default setting; repeatable. See gmt.conf for parameters.


Note: Below are some examples of valid syntax for this module. The examples that use remote files (file names starting with @) can be cut and pasted into your terminal for testing. Other commands requiring input files are just dummy examples of the types of uses that are common but cannot be run verbatim as written.

Note: Since many GMT plot examples are very short (i.e., one module call between the gmt begin and gmt end commands), we will often present them using the quick modern mode GMT Modern Mode One-line Commands syntax, which simplifies such short scripts.

To demonstrate a basic wiggle plot we create some synthetic data with math and pipe it through wiggle:

gmt math -T-8/6/0.01 -N3/0 -C2 T 3 DIV 2 POW NEG EXP T PI 2 MUL MUL COS MUL 50 MUL = | gmt wiggle -R-10/10/-3/3 -JM6i -B -Z100i -DjRM+w100+lnT -Tfaint -Gred+p -W1p -BWSne -pdf map

To plot the magnetic anomaly stored in the file track.xym along track @ 500 nTesla/cm (after removing a mean value of 32000 nTesla), using a 15-cm-wide Polar Stereographic map ticked every 5 degrees in Portrait mode, with positive anomalies in red on a blue track of width 0.25 points, use

gmt wiggle track.xym -R-20/10/-80/-60 -JS0/90/15c -Z500 -B5 \
             -C32000 -Gred -T0.25p,blue -DjRM+w1000+lnT -V -pdf track_xym

and the positive anomalies will in general point in the north direction. We used -D to place a vertical scale bar indicating a 1000 nT anomaly. To instead enforce a fixed azimuth of 45 for the positive wiggles, we add -I and obtain

gmt wiggle track.xym -R-20/10/-80/-60 -JS0/90/15c -Z1000 -B5 \
          -C32000 -Gred -I45 -T0.25p,blue -DjRM+w1000+lnT -V -pdf track_xym


Sometimes the (x, y) coordinates are not printed with enough significant digits, so the local perpendicular to the track swings around a lot. To see if this is the problem, you should do this:

gmt mapproject -Af yourdata.xyz | more

Then if these numbers jump around a lot, you may do this:

awk '{ print NR, $0 }' yourdata.xyz | filter1d -Fb5 -N4/0 --FORMAT_FLOAT_OUT=%.12g > smoothed.xyz

which performs a 5-point boxcar filter, and plot this data set instead.

See Also

gmt, gmtcolors, filter1d, basemap, split