TernaryListPlot

TernaryListPlot[{{u1,v1,w1},,{un,vn,wn}}]

plots a list of points with specified u, v and w coordinates in a barycentric coordinate system.

TernaryListPlot[{data1,data2,}]

plots a ternary plot with several datasets datai.

Details and Options

  • Ternary plots are also known as triangle plots or triaxial plots.
  • Ternary plots are typically used to show relative proportions among three components in a whole, such as composition of soil in geology, elements in a mixture in chemistry or sources of calories in nutrition.
  • Each point {ui,vi,wi} is normalized by using ui/ti, vi/ti and wi/ti, where ti=ui+vi+wi.
  • Points with negative or nonreal coordinates will be taken as missing data.
  • The transformation from the point {u,v,w} in barycentric coordinates to {x,y} in Cartesian coordinates is given by {x=v+w, y=w}.
  • TernaryListPlot draws points inside an equilateral triangle, with the u, v and w coordinates corresponding respectively to the bottom, right and left edges.
  • Coordinates ui, vi and wi can be given in the following forms:
  • uia real-valued number
    Quantity[ui,unit]a quantity with a unit
  • Values that are not of the form shown previously are taken to be missing and are not shown.
  • The datai have the following forms and interpretations:
  • <|"k1"{u1,v1,w1},"k2"{u2,v2,w2},|>values {y1,y2,}
    {{u1,v1,w1}"lbl1",{u1,v1,w1}"lbl2",}, {{u1,v1,w1},{u1,v1,w1},}{"lbl1","lbl2",}values {y1,y2,} with labels {lbl1,lbl2,}
    SparseArrayvalues as a normal array
    TimeSeries, EventSeriestime-value pairs
    QuantityArraymagnitudes
    NumericArrayvalues as a normal array
    WeightedDataunweighted values
  • The following wrappers w can be used for the datai:
  • Annotation[datai,label]provide an annotation for the data
    Button[datai,action]define an action to execute when the data is clicked
    Callout[datai,label]label the data with a callout
    Callout[datai,label,pos]place the callout at relative position pos
    EventHandler[datai,]define a general event handler for the data
    Hyperlink[datai,uri]make the data a hyperlink
    Labeled[datai,label]label the data
    Labeled[datai,label,pos]place the label at relative position pos
    Legended[datai,label]identify the data in a legend
    PopupWindow[datai,cont]attach a popup window to the data
    StatusArea[datai,label]display in the status area on mouseover
    Style[datai,styles]show the data using the specified styles
    Tooltip[datai,label]attach a tooltip to the data
    Tooltip[datai]use data values as tooltips
  • Wrappers w can be applied at multiple levels:
  • {,w[{ui,vi,wi}],}wrap the point {ui,vi,wi}
    w[datai]wrap the data
    w[{data1,}]wrap a collection of datai
    w1[w2[]]use nested wrappers
  • Callout, Labeled and Placed can use the following positions pos:
  • Automaticautomatically placed labels
    Abovepositions above data or points
    Belowpositions below data or points
    Beforepositions before data or points
    Afterpositions after data or points
    {pos,epos}epos in label placed at relative position pos of the data
  • TernaryListPlot has the same options as Graphics, with the following additions and changes:
  • AspectRatioAutomaticratio of width to height
    ColorFunction Nonehow to determine the coloring of points
    ColorFunctionScaling Truewhether to scale arguments to ColorFunction
    Frame Truewhether to put a frame around the plot
    GridLines Automaticgrid lines to draw
    GridLinesStyle {}how to style grid lines
    Joined Falsewhether to join points
    LabelingFunctionAutomatichow to label points
    LabelingSizeAutomaticmaximum size of callouts and labels
    PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
    PlotLabelNoneoverall label for the plot
    PlotLabels Nonelabels for data
    PlotLegends Nonelegends for data
    PlotMarkers Nonemarkers to use to indicate each point
    PlotRange Automaticrange of values to include
    PlotStyle Automaticgraphics directives to determine styles of points
    PlotTheme$PlotThemeoverall theme for the plot
    TargetUnits Automaticunits to display in the plot
    TernaryPlotCorners Automatichow to position the plot corners
  • The setting PlotRange{rangeu,rangev,rangew} uses the given ranges for each of the three axes. The ranges will be extended to ensure a whole triangle is shown.
  • Options that apply to each coordinate dimension, such as Axes, Frame and GridLines, can take the following forms:
  • suse regular setting s for each dimension
    {su,sv,sw}use setting su for the u direction etc.
  • The setting GridLinesStyleAutomatic will inherit the style used by axes or frames to draw the corresponding grid lines.
  • The arguments to ColorFunction are , and . By default, they are scaled so that the smallest values are zero and the largest values are one.
  • Setting ColorFunctionScalingFalse uses the unscaled, normalized values for the points.
  • When using data with units, the units for all components must be compatible.
  • TargetUnitsunit specifies what unit to use.

Examples

open allclose all

Basic Examples  (4)

Generate a ternary plot for a list of points whose values add up to 1:

Plot several sets of data:

Label points with indices:

Use plot markers to identify different sets:

Scope  (34)

General Data  (5)

Plot sets corresponding to fixed fractions of the first element "A":

Second element "B":

Third element "C":

Plot sets corresponding to fixed ratios of the element "B" to "C":

"A" to "B":

"A" to "C":

Each data point is independently normalized so the elements sum to 1:

Nonreal and negative data is taken to be missing:

Multiple datasets are styled differently:

Special Data  (4)

Plot data with units:

Specify the desired target units:

Use data with quantities:

Specify strings to use as labels:

Specify a location for labels:

Data Wrappers  (5)

Use wrappers on individual data, datasets or collections of datasets:

Wrappers can be nested:

Call out a point:

Set a Style for each dataset:

Apply nested wrappers:

Labeling and Legending  (12)

Label individual points:

Label every point:

Label data with Labeled:

Label data with PlotLabels:

Label data with Callout:

Use Placed to control label positions:

Label points at automatically optimized positions:

Specify PlotLegends for each dataset:

Specify the maximum size of labels:

Use the full label:

For dense sets of points, some labels may be turned into tooltips by default:

Increasing the size of the plot will show more labels:

Include legends for each dataset:

Use Legended to provide a legend to a specific dataset:

Use Placed to change the legend location:

Use association keys as labels:

Presentation  (8)

Multiple sets are automatically colored to be distinct:

Provide explicit styling to different sets:

Color points with ColorFunction:

Color by bottom, right and left coordinates:

Use different plot markers:

Join a list of points:

Style datasets or collections of datasets:

Specify grid lines:

Show no frames:

Set FrameTicksStyle:

Show barycentric axes:

Style axes:

Show axes and set the frame off to show the 0% lines:

Options  (36)

Axes  (1)

Show barycentric axes:

Set barycentric axes for given coordinates:

AxesStyle  (1)

Style axes:

Background  (1)

Change the overall background color:

Change the backdrop color:

ColorFunction  (3)

Color points by the x direction value:

Color points by a function:

Color by bottom, right and left coordinates:

ColorFunction overrides PlotStyle:

ColorFunctionScaling  (2)

Use ColorFunctionScaling False to get an unscaled value:

ColorFunctionScaling by default is True:

Frame  (1)

Show frames:

Show no frames:

Show part of frames:

Show the 0% lines when the frame is off:

FrameLabel  (1)

Place labels on each frame:

FrameStyle  (1)

Style frames:

Automatic GridLinesStyle are inherited from FrameStyle:

Change frame thickness:

FrameTicks  (1)

Change tick positions:

FrameTicksStyle  (1)

Change tick styles:

GridLines  (2)

Draw grid lines:

No grid lines:

Draw grid lines at specific positions:

Draw styled grid lines:

GridLines overrides GridLinesStyle:

GridLinesStyle  (1)

Style grid lines:

Style grid lines in each direction:

Joined  (2)

Points are joined in order of data:

Show points when joined:

Method  (5)

Set highlighting:

Change highlight color:

Use highlighting for axes and frames:

Change the background color of the area with data:

The backdrop area is associated with PlotRange:

PlotLabels  (3)

Label points at automatically optimized positions:

Use Placed to control label positions:

Label two sets of data:

PlotLegends  (1)

Show Automatic legends for different datasets:

Specify legends for each dataset:

Specify legends for each dataset using PlotMarkers:

PlotMarkers  (3)

Use a default sequence of shapes to distinguish datasets:

Do not use plot markers:

Use text or typeset labels to distinguish datasets:


Use any graphic to distinguish datasets:

Control font sizes for text markers:

Control sizes for graphics markers relative to the plot:

Control absolute sizes for graphics markers:

Use preset names to control graphics marker size:

PlotRange  (1)

Plot range by default is from 0 to 1 in all directions:

PlotStyle  (3)

Change the size of points:

Color each dataset:

Color datasets cyclically:

TargetUnits  (1)

Plot data with units:

Specify the desired target units:

TernaryPlotCorners  (1)

By default, the plot corners are positioned anticlockwise:

Position the plot corners clockwise:

Place the corners at given coordinates:

Applications  (7)

Geology  (2)

Plot a soil texture triangle:

Plot a soil texture triangle with shaded regions:

Agriculture  (2)

Plot the fraction of fertilizers used each year:

Show the planted fractions of three crops, corn, soybeans and wheat:

Other  (3)

Show the sources of electricity for countries around the world:

Show the fraction of child, adult and elderly populations around the world:

Show the fractions of fat, carbohydrates and proteins in a variety of foods:

Wolfram Research (2022), TernaryListPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/TernaryListPlot.html.

Text

Wolfram Research (2022), TernaryListPlot, Wolfram Language function, https://reference.wolfram.com/language/ref/TernaryListPlot.html.

CMS

Wolfram Language. 2022. "TernaryListPlot." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TernaryListPlot.html.

APA

Wolfram Language. (2022). TernaryListPlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TernaryListPlot.html

BibTeX

@misc{reference.wolfram_2022_ternarylistplot, author="Wolfram Research", title="{TernaryListPlot}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/TernaryListPlot.html}", note=[Accessed: 28-March-2023 ]}

BibLaTeX

@online{reference.wolfram_2022_ternarylistplot, organization={Wolfram Research}, title={TernaryListPlot}, year={2022}, url={https://reference.wolfram.com/language/ref/TernaryListPlot.html}, note=[Accessed: 28-March-2023 ]}