I’ve got two issues with 3D Volume. First,
go.Volume only displays correctly if there is the
.show() call, while most other widgets are perfectly fine without it in Jupyter environments. Second, after calling
.show(), I am not able to update the volume data from another cell. The following example shows the volume but fails updating it.
import plotly.graph_objects as go import numpy as np X, Y, Z = np.mgrid[:10, :10, :10] values = np.sin(X*Y*Z) / (X*Y*Z) fig = go.Figure(data=go.Volume( x=X.flatten(), y=Y.flatten(), z=Z.flatten(), value=values.flatten(), isomin=0.1, isomax=0.8, opacity=0.1, # needs to be small to see through all surfaces surface_count=17, # needs to be a large number for good volume rendering )) fig.show()
fig.data.value = values.flatten() * 10
Is there anything special about 3D graphs to know about? My goal is to animate this thing with my custom controls from ipywidgets.