# psternary

Plot data on ternary diagrams

## Synopsis

gmt psternary [ table ] [ -JX width ] [ -R amin/amax/bmin/bmax/cmin/cmax ] [ -B[p|s]parameters ] [ -C cpt ] [ -G fill ] [ -K ] [ -L a/b/c ] [ -M ] [ -N ] [ -O ] [ -P ] [ -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 ] [ -e regexp ] [ -f flags ] [ -g gaps ] [ -h headers ] [ -i flags ] [ -p flags ] [ -qi flags ] [ -t transp ] [ -:[i|o] ] [ --PAR=value ]

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

## 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 is <= 0 are skipped. If no symbols are specified then the symbol code (see -S below) must be present as last column in the input.

## Required Arguments

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

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

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

-L a/b/c

  Set the labels for the three diagram vertices [none]. These are placed a distance of 3 times the MAP_LABEL_OFFSET setting from their respective corners.

-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. If present, size is symbol size in the unit set in gmt.conf (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:

      *x y* [ *z* ] [ *size* ] [ *symbol-parameters* ] [ *symbol* ]

  where the optional z is required when -C is used, the optional size is required when no symbol size is specified, and the trailing text with the symbol code is required when symbol code is not specified on the command line. The symbol-parameters may vary in numbers; see specifics below.

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

  Choose between these symbol codes:

  -S-

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

  -S+

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

  -Sa

    star. size is diameter of circumscribing circle.

  -Sb[size[c|i|p|u]][+b[base]]

    Vertical bar extending from base to y. The size is bar width. Append u if size is in x-units [Default is plot-distance units]. By default, base = 0. Append +b[base] to change this value. If base is not appended then we read it from the last input data column. Use +B[base] if the bar height is measured relative to base [Relative to origin].

  -SB[size[c|i|p|u]][+b[base]]

    Horizontal bar extending from base to x. The size is bar width. Append u if size is in y-units [Default is plot-distance units]. By default, base = 0. Append +b[base] to change this value. If base is not appended then we read it from the last input data column. Use +B[base] if the bar length is measured relative to base [Relative to origin].

  -Sc

    circle. size is diameter of circle.

  -Sd

    diamond. size is diameter of circumscribing circle.

  -Se

    ellipse. Direction (in degrees counter-clockwise from horizontal), major_axis, and minor_axis must be found in columns 3, 4, and 5.

  -Sg

    octagon. size is diameter of circumscribing circle.

  -Sh

    hexagon. size is diameter of circumscribing circle.

  -Si

    inverted triangle. size is diameter of circumscribing circle.

  -Sj

    Rotated rectangle. Direction (in degrees counter-clockwise from horizontal), x-dimension, and y-dimension must be found in columns 3, 4, and 5.

  -Sk

    kustom symbol. Append name/size, and we will look for a definition file called name.def in (1) the current directory or (2) in ~/.gmt or (3) in $GMT_SHAREDIR/custom. The symbol as defined in that file is of size 1.0 by default; the appended size will scale symbol accordingly. Users may add their own custom *.def files; see CUSTOM SYMBOLS below.

  -Sl

    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

    pentagon. size is diameter of circumscribing circle.

  -Sp

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

  -Sr

    rectangle. No size needs to be specified, but the x- and y-dimensions must be found in columns 3 and 4.

  -SR

    Rounded rectangle. No size needs to be specified, but the x- and y-dimensions and corner radius must be found in columns 3, 4, and 5.

  -Ss

    square. size is diameter of circumscribing circle.

  -St

    triangle. size is diameter of circumscribing circle.

  -Sw

    pie wedge. Start and stop directions (in degrees counter-clockwise from horizontal) for pie slice must be found in columns 3 and 4. Append /inner to select a separate inner diameter [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.

  -SW

    Same as -Sw, except azimuths (in degrees east of north) should be given instead of the two directions. The azimuths will be mapped into angles based on the chosen map projection (-Sw leaves the directions unchanged). Append /inner to select a separate inner diameter [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

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

  -Sy

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

-U[label][+c][+j just][+o dx/dy] (more …)

  Draw GMT time stamp logo on plot.

-V[level] (more …)

  Select verbosity level [w].

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

  Set pen attributes for the outline of symbols.

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

-Y[a|c|f|r][yshift] (more …)

  Shift plot origin.

-bi[ncols][t] (more …)

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

-di nodata (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]z gap[+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][+s scale][+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[+c col][+a|f|s] (more …)

  Select input rows or data range(s) [all].

-:[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] (more …)

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

## Classic Mode Arguments

These options are used to manipulate the building of layered GMT PostScript plots in classic mode. They are not available when using GMT modern mode.

-K (more …)

  Do not finalize the PostScript plot.

-O (more …)

  Append to existing PostScript plot.

-P (more …)

  Select “Portrait” plot orientation.

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

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

    gmt makecpt -Cturbo -T0/80/10 > t.cpt
    gmt psternary @ternary.txt -R0/100/0/100/0/100 -JX6i -P -Sc0.1c -Ct.cpt -LWater/Air/Limestone \
        -Baafg+l"Water component"+u" %" -Bbafg+l"Air component"+u" %" -Bcagf+l"Limestone component"+u" %" \
        -B+givory+t"Example data from MATLAB Central" > map.ps

## See Also

gmt, gmt.conf, gmtcolors, psbasemap, psxy, psxyz