✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚾️ It's finally Baseball season! Root for the home team... & Register for our Sports Analytics Webinar! # Cannot create frames with intensity parameter in Mesh3D

Reposted from github: https://github.com/plotly/plotly.py/issues/917

While trying to animate a heat transfer problem using this excellent library I was unable to use frames in conjunction with a Mesh3D type trace. Is this unsupported or am I making a mistake?

I am trying to update the intensity value for each vertext of the mesh every iteration, so only the color of the mesh will change.

Are there any other ways of achieving this?

plotly version : 2.2.3

MWE:

``````n = 5
intensities = np.array([np.linspace(0,1,n), np.linspace(0,1,n),np.linspace(0,1,n)])
print(intensities.shape)

points = np.array([[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0]])
x, y, z = points.T
ii, jj, kk = [0,0],[1,1],[2,3]
triangles = graph_objs.Mesh3d(x=x, y=y, z=z, i=ii, j=jj, k=kk,
intensity=intensities[:,0],
colorscale= [['0', 'rgb(0, 0, 255)'],
['0.5', 'rgb(0, 255, 0)'],
['1', 'rgb(255, 0, 0)']],
lighting=dict(ambient=1.0, diffuse=1.0,
specular=0.0, roughness=1.0,
fresnel=0.0)
)
data = dict(type='mesh3D',
x=x, y=y, z=z,
intensity=intensities[:,0],
colorscale= [['0', 'rgb(0, 0, 255)'],
['0.5', 'rgb(0, 255, 0)'],
['1', 'rgb(255, 0, 0)']],
lighting=dict(ambient=1.0, diffuse=1.0,
specular=0.0, roughness=1.0,
fresnel=0.0)

)
frames =[dict(data=[dict(intensity=intensities[:,i])],
traces=,
name='frame{}'.format(i)) for i in range(n)]
graph_objs.Figure(data=[triangles], frames=frames)
``````

Which returns the following error:

``````PlotlyDictKeyError: 'intensity' is not allowed in 'scatter'

Path To Error: ['frames']['data']['intensity']
``````

It seems that the correct type of the trace is not found seeing as it is mesh3d not scatter.

Kind regards

Summary

This text will be hidden