Skip to content

Mesh3d

Overview

The mesh3d trace type is used to create 3D mesh plots, which visualize 3D surfaces defined by vertices and connections between them. Mesh plots are commonly used in 3D data visualization to represent geometric shapes, surfaces, and volumes.

You can customize the colors, vertex positions, and opacity to represent 3D data and geometries effectively.

Common Uses

  • 3D Geometries: Visualizing surfaces and volumes in 3D space.
  • Scientific Visualization: Representing complex 3D data in fields like physics, engineering, and geology.
  • 3D Surface Rendering: Displaying 3D surfaces from a set of points and connectivity information.

Check out the Attributes for the full set of configuration options

Examples

Common Configurations

Here's a simple mesh3d plot visualizing a 3D mesh structure with vertices and connections:

You can copy this code below to create this chart in your project:

models:
  - name: mesh3d-data
    args:
      - echo
      - |
        idx,x,y,z,i,j,k,color
        0,0,0,0,0,1,2,#1f77b4
        1,1,0,2,0,2,3,#ff7f0e
        2,2,1,0,0,3,1,#2ca02c
        3,0,2,1,1,2,3,#9467bd

traces:
  - name: Simple Mesh3D Plot
    model: ${ref(mesh3d-data)}
    props:
      type: mesh3d
      x: ?{x}
      y: ?{y}
      z: ?{z}
      i: ?{i}
      j: ?{j}
      k: ?{k}
      facecolor: ?{color}
      opacity: 0.7
    order_by: 
      - ?{ idx asc}
charts:
  - name: Simple Mesh3D Chart
    traces:
      - ${ref(Simple Mesh3D Plot)}
    layout:
      title:
        text: Simple Mesh3D Plot<br><sub>3D Mesh Surface Visualization</sub>

A schema to validate plotly trace properties

Attributes

These attributes apply to traces where trace.props.type is set to mesh3d. You would configure these attributes on the trace with the trace.props object.

alphahull: number
autocolorscale: boolean
cauto: boolean
cmax: number
cmid: number
cmin: number
color: any
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
contour:
  color: any
  show: boolean
  width: number
customdata: array
customdatasrc: 'string' #(11)!
delaunayaxis: any
facecolor: array
facecolorsrc: 'string' #(12)!
flatshading: boolean
hoverinfo: array
hoverinfosrc: 'string' #(13)!
hoverlabel:
  align: array
  alignsrc: 'string' #(14)!
  bgcolor: array
  bgcolorsrc: 'string' #(15)!
  bordercolor: array
  bordercolorsrc: 'string' #(16)!
  font:
    color: array
    colorsrc: 'string' #(17)!
    family: 'string | array' #(18)!
    familysrc: 'string' #(19)!
    lineposition: array
    linepositionsrc: 'string' #(20)!
    shadow: 'string | array' #(21)!
    shadowsrc: 'string' #(22)!
    size: array
    sizesrc: 'string' #(23)!
    style: array
    stylesrc: 'string' #(24)!
    textcase: array
    textcasesrc: 'string' #(25)!
    variant: array
    variantsrc: 'string' #(26)!
    weight: array
    weightsrc: 'string' #(27)!
  namelength: array
  namelengthsrc: 'string' #(28)!
hovertemplate: 'string | array' #(29)!
hovertemplatesrc: 'string' #(30)!
hovertext: 'string | array' #(31)!
hovertextsrc: 'string' #(32)!
i: array
ids: array
idssrc: 'string' #(33)!
intensity: array
intensitymode: any
intensitysrc: 'string' #(34)!
isrc: 'string' #(35)!
j: array
jsrc: 'string' #(36)!
k: array
ksrc: 'string' #(37)!
legend: string
legendgroup: 'string' #(38)!
legendgrouptitle:
  font:
    color: any
    family: 'string' #(39)!
    lineposition: any
    shadow: 'string' #(40)!
    size: number
    style: any
    textcase: any
    variant: any
    weight: integer
  text: 'string' #(41)!
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
metasrc: 'string' #(42)!
name: 'string' #(43)!
opacity: number
reversescale: boolean
scene: string
showlegend: boolean
showscale: boolean
stream:
  maxpoints: number
  token: 'string' #(44)!
text: 'string | array' #(45)!
textsrc: 'string' #(46)!
type: mesh3d
uid: 'string' #(47)!
vertexcolor: array
vertexcolorsrc: 'string' #(48)!
visible: any
x: array
xcalendar: any
xhoverformat: 'string' #(49)!
xsrc: 'string' #(50)!
y: array
ycalendar: any
yhoverformat: 'string' #(51)!
ysrc: 'string' #(52)!
z: array
zcalendar: any
zhoverformat: 'string' #(53)!
zsrc: 'string' #(54)!
  1. 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.
  2. 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.
  3. 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
  4. Sets a tick label prefix.
  5. Sets a tick label suffix.
  6. Sets the source reference on Chart Studio Cloud for ticktext.
  7. Sets the source reference on Chart Studio Cloud for tickvals.
  8. 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.
  9. 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.
  10. Sets the title of the color bar.
  11. Sets the source reference on Chart Studio Cloud for customdata.
  12. Sets the source reference on Chart Studio Cloud for facecolor.
  13. Sets the source reference on Chart Studio Cloud for hoverinfo.
  14. Sets the source reference on Chart Studio Cloud for align.
  15. Sets the source reference on Chart Studio Cloud for bgcolor.
  16. Sets the source reference on Chart Studio Cloud for bordercolor.
  17. Sets the source reference on Chart Studio Cloud for color.
  18. 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.
  19. Sets the source reference on Chart Studio Cloud for family.
  20. Sets the source reference on Chart Studio Cloud for lineposition.
  21. 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.
  22. Sets the source reference on Chart Studio Cloud for shadow.
  23. Sets the source reference on Chart Studio Cloud for size.
  24. Sets the source reference on Chart Studio Cloud for style.
  25. Sets the source reference on Chart Studio Cloud for textcase.
  26. Sets the source reference on Chart Studio Cloud for variant.
  27. Sets the source reference on Chart Studio Cloud for weight.
  28. Sets the source reference on Chart Studio Cloud for namelength.
  29. 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 in hovertemplate 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 are arrayOk: 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>.
  30. Sets the source reference on Chart Studio Cloud for hovertemplate.
  31. Same as text.
  32. Sets the source reference on Chart Studio Cloud for hovertext.
  33. Sets the source reference on Chart Studio Cloud for ids.
  34. Sets the source reference on Chart Studio Cloud for intensity.
  35. Sets the source reference on Chart Studio Cloud for i.
  36. Sets the source reference on Chart Studio Cloud for j.
  37. Sets the source reference on Chart Studio Cloud for k.
  38. 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.
  39. 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.
  40. 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.
  41. Sets the title of the legend group.
  42. Sets the source reference on Chart Studio Cloud for meta.
  43. Sets the trace name. The trace name appears as the legend item and on hover.
  44. The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details.
  45. Sets the text elements associated with the vertices. If trace hoverinfo contains a text flag and hovertext is not set, these elements will be seen in the hover labels.
  46. Sets the source reference on Chart Studio Cloud for text.
  47. Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.
  48. Sets the source reference on Chart Studio Cloud for vertexcolor.
  49. 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 using xaxis.hoverformat.
  50. Sets the source reference on Chart Studio Cloud for x.
  51. 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 using yaxis.hoverformat.
  52. Sets the source reference on Chart Studio Cloud for y.
  53. 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 using zaxis.hoverformat.
  54. Sets the source reference on Chart Studio Cloud for z.