# wiggle¶

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

## Synopsis¶

gmt wiggle [ table ] -Jparameters -Rwest/east/south/north[/zmin/zmax][+r][+uunit] -Zscale[units] [ -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[u]] ] [ -Y[a|c|f|r][yshift[u]] ] [ -bibinary ] [ -dinodata ] [ -eregexp ] [ -fflags ] [ -ggaps ] [ -hheaders ] [ -iflags ] [ -pflags ] [ -ttransp ] [ -:[i|o] ] [ --PAR=value ]

Note: No space is allowed between the option flag and the associated arguments.

## Description¶

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 plus/minus 90 degree window around the preferred direction, then 180 degrees are added to the direction. Either the positive or the negative wiggle may be shaded.

## Required Arguments¶

-Jparameters (more …)
Select map projection.
-Rxmin/xmax/ymin/ymax[+r][+uunit] (more …)
Specify the region of interest.

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

-Zscale[units]
Gives anomaly scale in data-units/distance-unit, where distance-unit is the currently chosen unit specified by PROJ_LENGTH_UNIT. Alternatively, append a distance-unit among the other choices (c|i|p).

## Optional Arguments¶

table
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.
-A[azimuth]
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/+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.
-B[p|s]parameters (more …)
Set map boundary frame and axes attributes.
-Ccenter
Subtract center from the data set before plotting [0].
-D[g|j|J|n|x]refpoint+wlength[+jjustify][+al|r][+odx[/dy]][+l[label]]
Defines the reference point on the map for the vertical scale bar using one of four coordinate systems: (1) Use -Dg for map (user) coordinates, (2) use -Dj or -DJ for setting refpoint via a 2-char justification code that refers to the (invisible) map domain rectangle, (3) use -Dn for normalized (0-1) coordinates, or (4) use -Dx for plot coordinates (inches, cm, etc.). All but -Dx requires both -R and -J to be specified. 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. Add +o to offset the vertical scale bar by dx/dy away from the refpoint point in the direction implied by justify (or the direction implied by -Dj or -DJ). 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.
Without further options, draws a rectangular border around the vertical scale bar using MAP_FRAME_PEN; specify a different pen with +ppen. Add +gfill to fill the scale panel [no fill]. Append +cclearance where clearance is either gap, xgap/ygap, or lgap/rgap/bgap/tgap where these items are uniform, separate in x- and y-direction, or individual side spacings between scale and border. Append +i to draw a secondary, inner border as well. We use a uniform gap between borders of 2p and the MAP_DEFAULTS_PEN unless other values are specified. Append +r to draw rounded rectangular borders instead, with a 6p corner radius. You can override this radius by appending another value. Finally, append +s to draw an offset background shaded region. Here, dx/dy indicates the shift relative to the foreground frame [4p/-4p] and shade sets the fill style to use for shading [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.
-Ifix_az
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 fixed_az.
-Tpen
Draw track [Default is no track]. Append pen attributes to use [Defaults: width = 0.25p, color = black, style = solid].
-U[label][+c][+jjust][+odx/dy] (more …)
Draw GMT time stamp logo on plot.
-V[level] (more …)
Select verbosity level [c].
-Wpen
Specify outline pen attributes [Default is no outline].
-bi[ncols][t] (more …)
Select native binary format for primary input. [Default is 3 input columns].
-dinodata (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.
-g[a]x|y|d|X|Y|D|[col]zgap[u][+n|p] (more …)
Determine data gaps and line breaks.
-h[i|o][n][+c][+d][+rremark][+rtitle] (more …)
-icols[+l][+sscale][+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.
-t[transp] (more …)
Set transparency level in percent.
-:[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 exits (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 exits.
-? or no arguments
Print a complete usage (help) message, including the explanation of all options, then exits.
--PAR=value
Temporarily override a GMT default setting; repeatable. See gmt.conf for parameters.

## Examples¶

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 gmtmath 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


## Bugs¶

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:

awk '{ if (NR > 1) print atan2(y-$1, x-$2); y=$1; x=$2; }' yourdata.xyz | more


(note that output is in radians; on some machines you need “nawk” to do this). 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.