Streamtube
Overview
The streamtube
trace type is used to create 3D streamtube plots, which visualize flow or vector field data in three dimensions. Streamtubes are ideal for visualizing the behavior of fluid flow, electromagnetic fields, or any vector data where the direction and magnitude of flow are important.
You can customize the color, size, and path of the streamtubes to represent the flow data effectively.
Common Uses
- Fluid Dynamics: Visualizing the flow of fluids in a 3D space.
- Vector Field Analysis: Analyzing vector fields like wind, magnetic, or electric fields.
- Flow Visualization: Representing flow behavior over time or space.
Check out the Attributes for the full set of configuration options
Examples
Common Configurations
This example uses a real, dense dataset from Plotly's sample CSV to ensure the streamtube renders properly:
models:
- name: streamtube-data
args:
- curl
- -sL
- https://raw.githubusercontent.com/plotly/datasets/master/streamtube-basic.csv
traces:
- name: Simple Streamtube Plot
model: ${ref(streamtube-data)}
props:
type: streamtube
x: ?{x}
y: ?{y}
z: ?{z}
u: ?{u}
v: ?{v}
w: ?{w}
charts:
- name: Simple Streamtube Chart
traces:
- ${ref(Simple Streamtube Plot)}
layout:
title:
text: Simple Streamtube Plot<br><sub>3D Vector Field Visualization</sub>
This example demonstrates a streamtube plot using the same CSV, with color mapping enabled:
models:
- name: streamtube-data
args:
- curl
- -sL
- https://raw.githubusercontent.com/plotly/datasets/master/streamtube-basic.csv
traces:
- name: Streamtube Plot with Color Mapping
model: ${ref(streamtube-data)}
props:
type: streamtube
x: ?{x}
y: ?{y}
z: ?{z}
u: ?{u}
v: ?{v}
w: ?{w}
colorscale: "Viridis"
charts:
- name: Streamtube Chart with Color Mapping
traces:
- ${ref(Streamtube Plot with Color Mapping)}
layout:
title:
text: Streamtube Plot with Color Mapping<br><sub>Vector Magnitude Represented by Color</sub>
This example uses the same CSV and sets a custom tube size reference:
models:
- name: streamtube-data
args:
- curl
- -sL
- https://raw.githubusercontent.com/plotly/datasets/master/streamtube-basic.csv
traces:
- name: Streamtube Plot with Custom Tube Sizes
model: ${ref(streamtube-data)}
props:
type: streamtube
x: ?{x}
y: ?{y}
z: ?{z}
u: ?{u}
v: ?{v}
w: ?{w}
sizeref: 0.5
charts:
- name: Streamtube Chart with Custom Tube Sizes
traces:
- ${ref(Streamtube Plot with Custom Tube Sizes)}
layout:
title:
text: Streamtube Plot with Custom Tube Sizes<br><sub>Vector Magnitude Represented by Tube Size</sub>
A schema to validate plotly trace properties
Attributes
These attributes apply to traces where trace.props.type
is set to streamtube
. You would configure these attributes on the trace with the trace.props
object.
autocolorscale: boolean
cauto: boolean
cmax: number
cmid: number
cmin: number
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' #(1)!
lineposition: any
shadow: 'string' #(2)!
size: number
style: any
textcase: any
variant: any
weight: integer
tickformat: 'string' #(3)!
tickformatstops: array
ticklabeloverflow: any
ticklabelposition: any
ticklabelstep: integer
ticklen: number
tickmode: any
tickprefix: 'string' #(4)!
ticks: any
ticksuffix: 'string' #(5)!
ticktext: array
ticktextsrc: 'string' #(6)!
tickvals: array
tickvalssrc: 'string' #(7)!
tickwidth: number
title:
font:
color: any
family: 'string' #(8)!
lineposition: any
shadow: 'string' #(9)!
size: number
style: any
textcase: any
variant: any
weight: integer
side: any
text: 'string' #(10)!
x: number
xanchor: any
xpad: number
xref: any
y: number
yanchor: any
ypad: number
yref: any
colorscale: any
customdata: array
customdatasrc: 'string' #(11)!
hoverinfo: array
hoverinfosrc: 'string' #(12)!
hoverlabel:
align: array
alignsrc: 'string' #(13)!
bgcolor: array
bgcolorsrc: 'string' #(14)!
bordercolor: array
bordercolorsrc: 'string' #(15)!
font:
color: array
colorsrc: 'string' #(16)!
family: 'string | array' #(17)!
familysrc: 'string' #(18)!
lineposition: array
linepositionsrc: 'string' #(19)!
shadow: 'string | array' #(20)!
shadowsrc: 'string' #(21)!
size: array
sizesrc: 'string' #(22)!
style: array
stylesrc: 'string' #(23)!
textcase: array
textcasesrc: 'string' #(24)!
variant: array
variantsrc: 'string' #(25)!
weight: array
weightsrc: 'string' #(26)!
namelength: array
namelengthsrc: 'string' #(27)!
hovertemplate: 'string | array' #(28)!
hovertemplatesrc: 'string' #(29)!
hovertext: 'string' #(30)!
ids: array
idssrc: 'string' #(31)!
legend: string
legendgroup: 'string' #(32)!
legendgrouptitle:
font:
color: any
family: 'string' #(33)!
lineposition: any
shadow: 'string' #(34)!
size: number
style: any
textcase: any
variant: any
weight: integer
text: 'string' #(35)!
legendrank: number
legendwidth: number
lighting:
ambient: number
diffuse: number
facenormalsepsilon: number
fresnel: number
roughness: number
specular: number
vertexnormalsepsilon: number
lightposition:
x: number
y: number
z: number
maxdisplayed: integer
metasrc: 'string' #(36)!
name: 'string' #(37)!
opacity: number
reversescale: boolean
scene: string
showlegend: boolean
showscale: boolean
sizeref: number
starts:
x: array
xsrc: 'string' #(38)!
y: array
ysrc: 'string' #(39)!
z: array
zsrc: 'string' #(40)!
stream:
maxpoints: number
token: 'string' #(41)!
text: 'string' #(42)!
type: streamtube
u: array
uhoverformat: 'string' #(43)!
uid: 'string' #(44)!
usrc: 'string' #(45)!
v: array
vhoverformat: 'string' #(46)!
visible: any
vsrc: 'string' #(47)!
w: array
whoverformat: 'string' #(48)!
wsrc: 'string' #(49)!
x: array
xhoverformat: 'string' #(50)!
xsrc: 'string' #(51)!
y: array
yhoverformat: 'string' #(52)!
ysrc: 'string' #(53)!
z: array
zhoverformat: 'string' #(54)!
zsrc: 'string' #(55)!
- 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
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. Finally, the template string has access to variablestubex
,tubey
,tubez
,tubeu
,tubev
,tubew
,norm
anddivergence
. 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
. - Same as
text
. - 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
meta
. - Sets the trace name. The trace name appears as the legend item and on hover.
- Sets the source reference on Chart Studio Cloud for
x
. - Sets the source reference on Chart Studio Cloud for
y
. - Sets the source reference on Chart Studio Cloud for
z
. - 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 a text element associated with this trace. If trace
hoverinfo
contains a text flag, this text element will be seen in all hover labels. Note that streamtube traces do not support arraytext
values. - Sets the hover text formatting rulefor
u
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.By default the values are formatted using generic number format. - Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.
- Sets the source reference on Chart Studio Cloud for
u
. - Sets the hover text formatting rulefor
v
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.By default the values are formatted using generic number format. - Sets the source reference on Chart Studio Cloud for
v
. - Sets the hover text formatting rulefor
w
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.By default the values are formatted using generic number format. - Sets the source reference on Chart Studio Cloud for
w
. - Sets the hover text formatting rulefor
x
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.46By default the values are formatted usingxaxis.hoverformat
. - Sets the source reference on Chart Studio Cloud for
x
. - Sets the hover text formatting rulefor
y
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.46By default the values are formatted usingyaxis.hoverformat
. - Sets the source reference on Chart Studio Cloud for
y
. - Sets the hover text formatting rulefor
z
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.46By default the values are formatted usingzaxis.hoverformat
. - Sets the source reference on Chart Studio Cloud for
z
.