Plot wind barbs in 2-D and 3-D


barb [ table ] -Jparameters -Jz|Zparameters -Rwest/east/south/north[/zmin/zmax][+r][+uunit] [ -B[p|s]parameters ] [ -Ccpt ] [ -Ddx/dy[/dz] ] [ -Gfill ] [ -Iintens ] [ -N ] [ -Qparameters ] [ -U[stamp] ] [ -V[level] ] [ -W[pen][attr] ] [ -X[a|c|f|r][xshift] ] [ -Y[a|c|f|r][yshift] ] [ -aflags ] [ -bibinary ] [ -dinodata[+ccol] ] [ -eregexp ] [ -fflags ] [ -hheaders ] [ -iflags ] [ -pflags ] [ -ttransp ] [ -:[i|o] ]

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


barb reads (x, y, azimuth, speed) from files [or standard input] and generates PostScript code that will plot wind barbs at those locations on a map. If -JZ|z is set, then barb will interpret the third column of the input data as z-values and plot wind barbs in 3-D. If the wind barb length is not given with -Q, then barb will interpret the third and fourth columns of the input data as barb length and width, respectively. Select a fill with -G. If -G is set, -W will control whether the outline is drawn or not. The PostScript code is written to standard output.

Required Arguments


Specify the projection. (See full description) (See cookbook summary) (See projections table).


Set z-axis scaling; same syntax as -Jx.


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 cookbook information).

The region may be specified in one of several ways:

  1. -Rwest/east/south/north. This is the standard way to specify geographic regions when using map projections where meridians and parallels are rectilinear. The coordinates may be specified in decimal degrees or in [±]dd:mm[][W|E|S|N] format.

  2. -Rwest/south/east/north+r. This form is useful for map projections that are oblique, making meridians and parallels poor choices for map boundaries. Here, we instead specify the lower left corner and upper right corner geographic coordinates, followed by the modifier +r. This form guarantees a rectangular map even though lines of equal longitude and latitude are not straight lines.

  3. -Rg or -Rd. These forms can be used to quickly specify the global domain (0/360 for -Rg and -180/+180 for -Rd in longitude, with -90/+90 in latitude).

  4. -Rcode1,code2,…[+e|r|Rincs]. This indirectly supplies the region by consulting the DCW (Digital Chart of the World) database and derives the bounding regions for one or more countries given by the codes. Simply append one or more comma-separated countries using either the two-character ISO 3166-1 alpha-2 convention (e.g., NO) or the full country name (e.g., Norway). To select a state within a country (if available), append .state (e.g, US.TX), or the full state name (e.g., Texas). To specify a whole continent, spell out the full continent name (e.g., -RAfrica). Finally, append any DCW collection abbreviations or full names for the extent of the collection or named region. All names are case-insensitive. The following modifiers can be appended:

    • +r to adjust the region boundaries to be multiples of the steps indicated by inc, xinc/yinc, or winc/einc/sinc/ninc [default is no adjustment]. For example, -RFR+r1 will select the national bounding box of France rounded to nearest integer degree, where inc can be positive to expand the region or negative to shrink the region.

    • +R to adjust the region by adding the amounts specified by inc, xinc/yinc, or winc/einc/sinc/ninc [default is no extension], where inc can be positive to expand the region or negative to shrink the region.

    • +e to adjust the region boundaries to be multiples of the steps indicated by inc, xinc/yinc, or winc/einc/sinc/ninc, while ensuring that the bounding box is adjusted by at least 0.25 times the increment [default is no adjustment], where inc can be positive to expand the region or negative to shrink the region.

  5. -Rxmin/xmax/ymin/ymax[+uunit] specifies a region in projected units (e.g., UTM meters) where xmin/xmax/ymin/ymax are Cartesian projected coordinates compatible with the chosen projection (-J) and unit is an allowable distance unit [e]; we inversely project to determine the actual rectangular geographic region. For projected regions centered on (0,0) you may use the short-hand -Rhalfwidth[/halfheight]+uunit, where halfheight defaults to halfwidth if not given. This short-hand requires the +u modifier.

  6. -Rjustifylon0/lat0/nx/ny, where justify is a 2-character combination of L|C|R (for left, center, or right) and T|M|B (for top, middle, or bottom) (e.g., BL for lower left). The two character code justify indicates which point on a rectangular region region the lon0/lat0 coordinates refer to and the grid dimensions nx and ny are used with grid spacings given via -I to create the corresponding region. This method can be used when creating grids. For example, -RCM25/25/50/50 specifies a 50x50 grid centered on 25,25.

  7. -Rgridfile. This will copy the domain settings found for the grid in specified file. Note that depending on the nature of the calling module, this mechanism will also set grid spacing and possibly the grid registration (see Grid registration: The -r option).

  8. -Ra[uto] or -Re[xact]. Under modern mode, and for plotting modules only, you can automatically determine the region from the data used. You can either get the exact area using -Re [Default if no -R is given] or a slightly larger area sensibly rounded outwards to the next multiple of increments that depend on the data range using -Ra.

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

Optional 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.


Set map boundary frame and axes attributes. (See full description) (See cookbook information).


Give a CPT or specify -Ccolor1,color2[,color3,…] to build a linear continuous CPT from those colors automatically. In this case colorn can be a r/g/b triplet, a color name, or an HTML hexadecimal color (e.g. #aabbcc ). Let fill color be determined by the t-value in the third (or fourth if -Jz is set) column. Additional fields are shifted over by one column (wind barb azimuth would be in 4th rather than 5th field, etc.).


Offset the plot symbol or line locations by the given amounts dx/dy[dz] [Default is no offset].


Select color or pattern for filling of symbols or polygons [Default is no fill]. Note that barb will search for -G and -W strings in all the segment headers and let any values thus found over-ride the command line settings.


Use the supplied intens value (nominally in the ±1 range) to modulate the fill color by simulating illumination [none].


Do NOT clip symbols that fall outside map border [Default plots points whose coordinates are strictly inside the map border only]. The option does not apply to lines and polygons which are always clipped to the map region. For periodic (360-longitude) maps we must plot all symbols twice in case they are clipped by the repeating boundary. The -N will turn off clipping and not plot repeating symbols. Use -Nr to turn off clipping but retain the plotting of such repeating symbols, or use -Nc to retain clipping but turn off plotting of repeating symbols.


Modify wind barb parameters. Append wind barb length [Default is 0.5c]. See Wind Barb Attributes for specifying additional attributes.


Draw GMT time stamp logo on plot. (See full description) (See cookbook information).


Select verbosity level [w]. (See full description) (See cookbook information).

-W[pen][attr] (more …)

Set pen attributes for lines or the outline of symbols [Defaults: width = default, color = black, style = solid]. If the modifier +cl is appended then the color of the line are taken from the CPT (see -C). If instead modifier +cf is appended then the color from the cpt file is applied to symbol fill. Use just +c for both effects.


Shift plot origin. (See full description) (See cookbook information).


Shift plot origin. (See full description) (See cookbook information).

-a[[col=]name[,]] (more …)

Set aspatial column associations col=name.

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

Select native binary format for primary table input. [Default is the required number of columns given the chosen settings].

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

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

-ttransp[/transp2] (more …)

Set transparency level(s) 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 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.

Wind Barb Attributes

Several modifiers may be appended to the windbarb-producing options to specify the placement of barbs, their shapes, and the justification of the wind barb. Below, left and right refers to the side of the wind barb line when viewed from the start point to the end point of the segment:

+aangle sets the angle of the wind barb [120].

+g-|fill turns off wind barb fill (if -) or sets the wind barb fill [Default fill is used, which may be no fill].

+p[-][pen] sets the wind barb pen attributes. If pen has a leading - then the outline is not drawn. [Default pen is used, and outline is drawn]

+jjust determines how the input x,y point relates to the wind barb. Choose from beginning [default], end, or center.

+s to set the wind speed which corresponds to a long barb [default 5]

+w to set the width of wind barbs

+z to input (u,v) wind components instead of (azimuth,speed)


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 plot blue columns (width = 1.25 cm) at the positions listed in the file on a 3-D projection of the space (0-10), (0-10), (0-100), with tickmarks every 2, 2, and 10, viewing it from the southeast at 30 degree elevation, use:

gmt barb -R0/10/0/10/0/100 -Jx1.25c -Jz0.125c -So1.25c -Gblue \
         -Bx2+lXLABEL -By2+lYLABEL -Bz10+lZLABEL -B+t"3-D PLOT" -p135/30 -Uc -W -pdf heights

Segment Header Parsing

Segment header records may contain one of more of the following options:


Use the new fill and turn filling on.


Turn filling off.


Revert to default fill (none if not set on command line).


Use the new pen and turn outline on.


Revert to default pen MAP_DEFAULT_PEN (if not set on command line).


Turn outline off.


Obtain fill via cpt lookup using z-value zval.


Get the NaN color from the CPT.

See Also

gmt.conf, gmt, gmtcolors, grdbarb, plot3d