# ternary

Plot data on ternary diagrams

## Synopsis

gmt ternary [ table ] [ -J X[-]width ] [ -R amin/amax/bmin/bmax/cmin/cmax ] [ -B[p|s]parameters ] [ -C cpt ] [ -G fill ] [ -L a/b/c ] [ -M ] [ -N ] [ -S[symbol][size] ] [ -U[stamp] ] [ -V[level] ] [ -W[pen][attr] ] [ -X[a|c|f|r][xshift] ] [ -Y[a|c|f|r][yshift] ] [ -bi binary ] [ -di nodata[+c col] ] [ -e regexp ] [ -f flags ] [ -g gaps ] [ -h headers ] [ -i flags ] [ -p flags ] [ -qi flags ] [ -s flags ] [ -t transp ] [ -:[i|o] ] [ --PAR=value ]

## Description

Reads (a,b,c[,z]) records from table [or standard input] and plots symbols at those locations on a ternary diagram. If a symbol is selected and no symbol size given, then we will interpret the fourth column of the input data as symbol size. Symbols whose size \(\leq 0\) are skipped. If no symbols are specified then the symbol code (see -S below) must be present as last column in the input. If -S is not specified then we instead plot lines or polygons.

## Required Arguments

Either -M (for dumping data) or -R and -J must be selected.

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.

## Optional Arguments

-B[a|b|c]args

  For ternary diagrams the three sides are referred to as a, b, and c. Thus, to give specific settings for one of these axis you must include the axis letter before the arguments. If all axes have the same arguments then only give one option without the axis letter. For more details, see the -B discussion in basemap.

-C cpt

  Give a CPT or specify -C color1,color2[,color3,…] to build a linear continuous CPT from those colors automatically. In this case color n can be a r/g/b triplet, a color name, or an HTML hexadecimal color (e.g. #aabbcc ). If -S is set, let symbol fill color be determined by the z-value in the fourth column. Additional fields are shifted over by one column (optional size would be 5th rather than 4th field, etc.). If modern mode and no argument is given then we select the current CPT.

-G fill (more …)

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

-JX[-]width

  The only valid projection is linear plot with specified ternary width. Use a negative width to indicate that positive axes directions be clock-wise [Default lets the a, b, c axes be positive in a counter-clockwise direction].

-L a/b/c

  Set the labels for the three diagram vertices where the component is 100% [none]. These are placed at a distance of three times the MAP_LABEL_OFFSET setting from their respective corners. To skip any one of them, specify that label as -.

-M

  Do no plotting. Instead, convert the input (a,b,c[,z]) records to Cartesian (x,y,[,z]) records, where x, y are normalized coordinates on the triangle (i.e., 0–1 in x and 0–sqrt(3)/2 in y).

-N

  Do not clip symbols that fall outside map border [Default plots points whose coordinates are strictly inside the map border only].

-R amin/amax/bmin/bmax/cmin/cmax

  Give the min and max limits for each of the three axis a, b, and c.

-S[symbol][size]

  Plot individual symbols in a ternary diagram. If -S is not given then we will instead plot lines (requires -W) or polygons (requires -C or -G). If present, size is symbol size in the unit set by PROJ_LENGTH_UNIT (unless c, i, or p is appended). If the symbol code (see below) is not given it will be read from the last column in the input data; this cannot be used in conjunction with binary input. Optionally, append c, i, or p to indicate that the size information in the input data is in units of cm, inch, or point, respectively [Default is PROJ_LENGTH_UNIT]. Note: If you provide both size and symbol via the input file you must use PROJ_LENGTH_UNIT to indicate the unit used for the symbol size or append the units to the sizes in the file. If symbol sizes are expected via the third data column then you may convert those values to suitable symbol sizes via the -i mechanism. The general input expectations are:

  coordinates [ value ] [ parameters ] [ symbol ]

  where coordinates is two or three columns specifying the location of a point, the optional value is required when -C is used to control color, the optional parameters is required when no symbol size is specified, and the trailing text with leading symbol code is required when the symbol code is not specified on the command line. Note: parameters may represent more than one size column as some symbols require several parameters to be defined (e.g., a circle just needs one column, a rectangle needs two dimensions, while an ellipse needs an orientation and two dimensions, and so on); see specifics below. When there is only a single parameter we will refer to it as size.

  The uppercase symbols A, C, D, G, H, I, N, S, T are normalized to have the same area as a circle with diameter size, while the size of the corresponding lowercase symbols refers to the diameter of a circumscribed circle.

  You can change symbols by adding the required -S option to any of your multi-segment headers.

  Choose between these symbol codes:

  -S-size

    x-dash (-). size is the length of a short horizontal (x-dir) line segment.

  -S+size

    plus (+). size is diameter of circumscribing circle.

  -Sa size

    star. size is diameter of circumscribing circle.

  -Sc size

    circle. size is diameter of circle.

  -Sd size

    diamond. size is diameter of circumscribing circle.

  -Se direction/major_axis/minor_axis

    ellipse. If not given, then direction (in degrees counter-clockwise from horizontal), major_axis, and minor_axis must be found after the location [and value] columns. If only a single size is given then we plot a degenerate ellipse (circle) with given diameter.

  -Sg size

    octagon. size is diameter of circumscribing circle.

  -Sh size

    hexagon. size is diameter of circumscribing circle.

  -Si size

    inverted triangle. size is diameter of circumscribing circle.

  -Sj direction/width/height

    Rotated rectangle. If not given, then direction (in degrees counter-clockwise from horizontal), width, and height must be found after the location [and value] columns. If only a single size is given then we plot a degenerate rectangle (square) with given size.

  -Sk name/size

    kustom symbol. We will look for a symbol definition file called name.def in (1) the current directory, (2) in ~/.gmt or (3) in $GMT_SHAREDIR/custom. The symbol defined in the definition file is of normalized unit size by default; the appended size will scale the symbol accordingly. Users may create their own custom *.def files; see Custom Symbols. Alternatively, you can supply an EPS file instead of a *.def file and we will scale and place that graphic as a symbol.

  -Sl size+t string[+f font][+j justify]

    letter or text string (less than 256 characters). Give size, and append +t string after the size. Note that the size is only approximate; no individual scaling is done for different characters. Remember to escape special characters like *. Optionally, you may append +f font to select a particular font [Default is FONT_ANNOT_PRIMARY] and +j justify to change justification [CM].

  -Sn size

    pentagon. size is diameter of circumscribing circle.

  -Sp

    point. No size needs to be specified (1 pixel is used).

  -Sr width/height

    rectangle. If width/height are not given, then these dimensions must be found after the location [and value] columns. Alternatively, append +s and then the diagonal corner coordinates are expected after the location [and value] columns instead.

  -SR width/height/radius

    Rounded rectangle. If width/height/radius are not given, then the two dimensions and corner radius must be found after the location [and value] columns.

  -Ss size

    square. size is diameter of circumscribing circle.

  -St size

    triangle. size is diameter of circumscribing circle.

  -Sw[outer[/startdir/stopdir]][+i[inner]]

    Pie wedge. Give the outer diameter outer, startdir and stopdir. These are directions (in degrees counter-clockwise from horizontal) for wedge. Parameters not appended are read from file after the location [and value] columns. Append +i and append a nonzero inner diameter inner or it will be read last [0]. Append +a[dr] to draw the arc line (at inner and outer diameter); if dr is appended then we draw all arc lines separated radially by dr. Append +r[da] to draw radial lines (at start and stop directions) if da is appended then we draw all radial lines separated angularly by da. These spider-web lines are drawn using the current pen unless +p pen is added.

  -Sx size

    cross (x). size is diameter of circumscribing circle.

  -Sy size

    y-dash (|). size is the length of a short vertical (y-dir) line segment.

-U[label|+c][+j justify][+o dx[/dy]][+t text]

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

-V[level]

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

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

  Set pen attributes for the outline of symbols.

-X[a|c|f|r][xshift]

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

-Y[a|c|f|r][yshift]

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

-bi record[+b|l] (more …)

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

-di nodata[+c col] (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|D gap[u][+a][+c col][+n|p] (more …)

  Determine data gaps and line breaks. The -g option is ignored if -S is set.

-h[i|o][n][+c][+d][+m segheader][+r remark][+t title] (more …)

  Skip or produce header record(s).

-i cols[+l][+d divisor][+s scale|d|k][+o offset][,…][,t[word]] (more …)

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

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

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

-s[cols][+a][+r] (more …)

  Set handling of NaN records for output.

-:[i|o] (more …)

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

-p[x|y|z]azim[/elev[/zlevel]][+w lon0/lat0[/z0]][+v x0/y0] (more …)

  Select perspective view.

-t transp[/transp2] (more …)

  Set transparency level(s) in percent.

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

--PAR=value

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

## Examples

To plot circles (diameter = 0.1 cm) on a 15-centimeter-wide ternary diagram at the positions listed in the file ternary.txt, with default annotations and gridline spacings, using the specified labeling, try:

    gmt begin map
      gmt makecpt -Cturbo -T0/80/10
      gmt ternary @ternary.txt -R0/100/0/100/0/100 -JX15c -Sc0.1c -C -LLimestone/Water/Air \
        -Baafg+l"Limestone component"+u" %" -Bbafg+l"Water component"+u" %" -Bcagf+l"Air component"+u" %" \
        -B+givory+t"Example data from MATLAB Central"
    gmt end show

## See Also

gmt, gmt.conf, gmtcolors, basemap, plot, plot3d