Scatterternary
Overview
The scatterternary
trace type is used to create scatter plots on ternary plots, which are used for visualizing proportions that sum to a constant, such as in chemistry or economics where three components are involved. Ternary plots are useful for showing the relationship between three variables that are interdependent.
You can customize the marker size, color, and lines to connect points, similar to scatter plots but within a ternary plot.
Common Uses
- Proportional Data Visualization: Visualizing data that involves proportions of three components.
- Ternary Relationship Analysis: Exploring how three components relate to one another.
- Chemistry and Economics: Commonly used in fields like chemistry, soil science, and economics for visualizing compositional data.
Check out the Attributes for the full set of configuration options
Examples
Common Configurations
Here's a simple scatterternary
plot showing data points on a ternary plot:
You can copy this code below to create this chart in your project:
models:
- name: scatterternary-data
args:
- echo
- |
a,b,c
0.1,0.5,0.4
0.3,0.4,0.3
0.5,0.3,0.2
0.7,0.2,0.1
traces:
- name: Simple Scatterternary Plot
model: ${ref(scatterternary-data)}
props:
type: scatterternary
a: ?{a}
b: ?{b}
c: ?{c}
mode: "markers"
charts:
- name: Simple Scatterternary Chart
traces:
- ${ref(Simple Scatterternary Plot)}
layout:
title:
text: Simple Scatterternary Plot<br><sub>Data Points on a Ternary Plot</sub>
This example demonstrates a scatterternary
plot with lines connecting the data points on a ternary plot:
Here's the code:
models:
- name: scatterternary-data-lines
args:
- echo
- |
a,b,c
0.2,0.6,0.2
0.4,0.3,0.3
0.6,0.2,0.2
0.8,0.1,0.1
traces:
- name: Scatterternary Plot with Lines
model: ${ref(scatterternary-data-lines)}
props:
type: scatterternary
a: ?{a}
b: ?{b}
c: ?{c}
mode: "lines+markers"
charts:
- name: Scatterternary Chart with Lines
traces:
- ${ref(Scatterternary Plot with Lines)}
layout:
title:
text: Scatterternary Plot with Lines<br><sub>Connecting Data Points on a Ternary Plot</sub>
Here's a scatterternary
plot with custom marker sizes and colors, giving more visual weight to each data point on a ternary plot:
Here's the code:
models:
- name: scatterternary-data-custom
args:
- echo
- |
a,b,c,size,color
0.1,0.5,0.4,10,#1f77b4
0.3,0.4,0.3,15,#ff7f0e
0.5,0.3,0.2,20,#2ca02c
0.7,0.2,0.1,25,#d62728
traces:
- name: Scatterternary Plot with Custom Markers
model: ${ref(scatterternary-data-custom)}
props:
type: scatterternary
a: ?{a}
b: ?{b}
c: ?{c}
mode: "markers"
marker:
size: ?{size}
color: ?{color}
charts:
- name: Scatterternary Chart with Custom Markers
traces:
- ${ref(Scatterternary Plot with Custom Markers)}
layout:
title:
text: Scatterternary Plot with Custom Markers<br><sub>Custom Sizes and Colors for Ternary Data Points</sub>
A schema to validate plotly trace properties
Attributes
These attributes apply to traces where trace.props.type
is set to scatterternary
. You would configure these attributes on the trace with the trace.props
object.
a: array
asrc: 'string' #(1)!
b: array
bsrc: 'string' #(2)!
c: array
cliponaxis: boolean
connectgaps: boolean
csrc: 'string' #(3)!
customdata: array
customdatasrc: 'string' #(4)!
fill: any
fillcolor: any
hoverinfo: array
hoverinfosrc: 'string' #(5)!
hoverlabel:
align: array
alignsrc: 'string' #(6)!
bgcolor: array
bgcolorsrc: 'string' #(7)!
bordercolor: array
bordercolorsrc: 'string' #(8)!
font:
color: array
colorsrc: 'string' #(9)!
family: 'string | array' #(10)!
familysrc: 'string' #(11)!
lineposition: array
linepositionsrc: 'string' #(12)!
shadow: 'string | array' #(13)!
shadowsrc: 'string' #(14)!
size: array
sizesrc: 'string' #(15)!
style: array
stylesrc: 'string' #(16)!
textcase: array
textcasesrc: 'string' #(17)!
variant: array
variantsrc: 'string' #(18)!
weight: array
weightsrc: 'string' #(19)!
namelength: array
namelengthsrc: 'string' #(20)!
hoveron: string
hovertemplate: 'string | array' #(21)!
hovertemplatesrc: 'string' #(22)!
hovertext: 'string | array' #(23)!
hovertextsrc: 'string' #(24)!
ids: array
idssrc: 'string' #(25)!
legend: string
legendgroup: 'string' #(26)!
legendgrouptitle:
font:
color: any
family: 'string' #(27)!
lineposition: any
shadow: 'string' #(28)!
size: number
style: any
textcase: any
variant: any
weight: integer
text: 'string' #(29)!
legendrank: number
legendwidth: number
line:
backoff: array
backoffsrc: 'string' #(30)!
color: any
dash: 'string' #(31)!
shape: any
smoothing: number
width: number
marker:
angle: array
angleref: any
anglesrc: 'string' #(32)!
autocolorscale: boolean
cauto: boolean
cmax: number
cmid: number
cmin: number
color: array
coloraxis: string
colorbar:
bgcolor: any
bordercolor: any
borderwidth: number
exponentformat: any
len: number
lenmode: any
minexponent: number
nticks: integer
orientation: any
outlinecolor: any
outlinewidth: number
separatethousands: boolean
showexponent: any
showticklabels: boolean
showtickprefix: any
showticksuffix: any
thickness: number
thicknessmode: any
tickangle: number
tickcolor: any
tickfont:
color: any
family: 'string' #(33)!
lineposition: any
shadow: 'string' #(34)!
size: number
style: any
textcase: any
variant: any
weight: integer
tickformat: 'string' #(35)!
tickformatstops: array
ticklabeloverflow: any
ticklabelposition: any
ticklabelstep: integer
ticklen: number
tickmode: any
tickprefix: 'string' #(36)!
ticks: any
ticksuffix: 'string' #(37)!
ticktext: array
ticktextsrc: 'string' #(38)!
tickvals: array
tickvalssrc: 'string' #(39)!
tickwidth: number
title:
font:
color: any
family: 'string' #(40)!
lineposition: any
shadow: 'string' #(41)!
size: number
style: any
textcase: any
variant: any
weight: integer
side: any
text: 'string' #(42)!
x: number
xanchor: any
xpad: number
xref: any
y: number
yanchor: any
ypad: number
yref: any
colorscale: any
colorsrc: 'string' #(43)!
gradient:
color: array
colorsrc: 'string' #(44)!
type: array
typesrc: 'string' #(45)!
line:
autocolorscale: boolean
cauto: boolean
cmax: number
cmid: number
cmin: number
color: array
coloraxis: string
colorscale: any
colorsrc: 'string' #(46)!
reversescale: boolean
width: array
widthsrc: 'string' #(47)!
maxdisplayed: number
opacity: array
opacitysrc: 'string' #(48)!
reversescale: boolean
showscale: boolean
size: array
sizemin: number
sizemode: any
sizeref: number
sizesrc: 'string' #(49)!
standoff: array
standoffsrc: 'string' #(50)!
symbol: array
symbolsrc: 'string' #(51)!
metasrc: 'string' #(52)!
mode: any
name: 'string' #(53)!
opacity: number
selected:
marker:
color: any
opacity: number
size: number
textfont:
color: any
showlegend: boolean
stream:
maxpoints: number
token: 'string' #(54)!
subplot: string
sum: number
text: 'string | array' #(55)!
textfont:
color: array
colorsrc: 'string' #(56)!
family: 'string | array' #(57)!
familysrc: 'string' #(58)!
lineposition: array
linepositionsrc: 'string' #(59)!
shadow: 'string | array' #(60)!
shadowsrc: 'string' #(61)!
size: array
sizesrc: 'string' #(62)!
style: array
stylesrc: 'string' #(63)!
textcase: array
textcasesrc: 'string' #(64)!
variant: array
variantsrc: 'string' #(65)!
weight: array
weightsrc: 'string' #(66)!
textposition: array
textpositionsrc: 'string' #(67)!
textsrc: 'string' #(68)!
texttemplate: 'string | array' #(69)!
texttemplatesrc: 'string' #(70)!
type: scatterternary
uid: 'string' #(71)!
unselected:
marker:
color: any
opacity: number
size: number
textfont:
color: any
visible: any
- Sets the source reference on Chart Studio Cloud for
a
. - Sets the source reference on Chart Studio Cloud for
b
. - Sets the source reference on Chart Studio Cloud for
c
. - Sets the source reference on Chart Studio Cloud for
customdata
. - Sets the source reference on Chart Studio Cloud for
hoverinfo
. - Sets the source reference on Chart Studio Cloud for
align
. - Sets the source reference on Chart Studio Cloud for
bgcolor
. - Sets the source reference on Chart Studio Cloud for
bordercolor
. - Sets the source reference on Chart Studio Cloud for
color
. - HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the source reference on Chart Studio Cloud for
family
. - Sets the source reference on Chart Studio Cloud for
lineposition
. - Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the source reference on Chart Studio Cloud for
shadow
. - Sets the source reference on Chart Studio Cloud for
size
. - Sets the source reference on Chart Studio Cloud for
style
. - Sets the source reference on Chart Studio Cloud for
textcase
. - Sets the source reference on Chart Studio Cloud for
variant
. - Sets the source reference on Chart Studio Cloud for
weight
. - Sets the source reference on Chart Studio Cloud for
namelength
. - Template string used for rendering the information that appear on hover box. Note that this will override
hoverinfo
. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%xother}, {%_xother}, {%xother_}. When showing info for several points, xother will be added to those with different x positions from the first point. An underscore before or after (x|y)other will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available inhovertemplate
are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that arearrayOk: true
) are available. Anything contained in tag<extra>
is displayed in the secondary box, for example "{fullData.name} ". To hide the secondary box completely, use an empty tag<extra></extra>
. - Sets the source reference on Chart Studio Cloud for
hovertemplate
. - Sets hover text elements associated with each (a,b,c) point. If a single string, the same string appears over all the data points. If an array of strings, the items are mapped in order to the the data points in (a,b,c). To be seen, trace
hoverinfo
must contain a text flag. - Sets the source reference on Chart Studio Cloud for
hovertext
. - Sets the source reference on Chart Studio Cloud for
ids
. - Sets the legend group for this trace. Traces and shapes part of the same legend group hide/show at the same time when toggling legend items.
- HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the title of the legend group.
- Sets the source reference on Chart Studio Cloud for
backoff
. - Sets the dash style of lines. Set to a dash type string (solid, dot, dash, longdash, dashdot, or longdashdot) or a dash length list in px (eg 5px,10px,2px,2px).
- Sets the source reference on Chart Studio Cloud for
angle
. - HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: %h for half of the year as a decimal number as well as %{n}f for fractional seconds with n digits. For example, 2016-10-13 09:15:23.456 with tickformat %H~%M~%S.%2f would display 09~15~23.46
- Sets a tick label prefix.
- Sets a tick label suffix.
- Sets the source reference on Chart Studio Cloud for
ticktext
. - Sets the source reference on Chart Studio Cloud for
tickvals
. - HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the title of the color bar.
- Sets the source reference on Chart Studio Cloud for
color
. - Sets the source reference on Chart Studio Cloud for
color
. - Sets the source reference on Chart Studio Cloud for
type
. - Sets the source reference on Chart Studio Cloud for
color
. - Sets the source reference on Chart Studio Cloud for
width
. - Sets the source reference on Chart Studio Cloud for
opacity
. - Sets the source reference on Chart Studio Cloud for
size
. - Sets the source reference on Chart Studio Cloud for
standoff
. - Sets the source reference on Chart Studio Cloud for
symbol
. - Sets the source reference on Chart Studio Cloud for
meta
. - Sets the trace name. The trace name appears as the legend item and on hover.
- The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details.
- Sets text elements associated with each (a,b,c) point. If a single string, the same string appears over all the data points. If an array of strings, the items are mapped in order to the the data points in (a,b,c). If trace
hoverinfo
contains a text flag and hovertext is not set, these elements will be seen in the hover labels. - Sets the source reference on Chart Studio Cloud for
color
. - HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the source reference on Chart Studio Cloud for
family
. - Sets the source reference on Chart Studio Cloud for
lineposition
. - Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the source reference on Chart Studio Cloud for
shadow
. - Sets the source reference on Chart Studio Cloud for
size
. - Sets the source reference on Chart Studio Cloud for
style
. - Sets the source reference on Chart Studio Cloud for
textcase
. - Sets the source reference on Chart Studio Cloud for
variant
. - Sets the source reference on Chart Studio Cloud for
weight
. - Sets the source reference on Chart Studio Cloud for
textposition
. - Sets the source reference on Chart Studio Cloud for
text
. - Template string used for rendering the information text that appear on points. Note that this will override
textinfo
. Variables are inserted using %{variable}, for example "y: %{y}". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Every attributes that can be specified per-point (the ones that arearrayOk: true
) are available. Finally, the template string has access to variablesa
,b
,c
andtext
. - Sets the source reference on Chart Studio Cloud for
texttemplate
. - Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.