-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Plotly version -- 5.10.0
Environment -- Python 3.8.6 on Windows 10 x64
Below is a code example:
import plotly.graph_objects as go
import numpy as np
X = np.linspace(-10,10,100)
Y = np.linspace(-10,10,100)
Z = np.linspace(0,10,20)
coords = [X,Y,Z]
coord_mesh = np.concatenate([i.ravel().reshape(-1,1) for i in np.meshgrid(*coords)], axis=-1)
data = coord_mesh[:,-1].copy()
data_min, data_max = np.nanmin(data), np.nanmax(data)
DATA_REPLACE = 5
for i in range(data.size):
currcoords = coord_mesh[i,:]
if(currcoords[0]**2 + currcoords[1]**2 < 4):
data[i] = DATA_REPLACE
ISOVAL = 6
fig = go.Figure(
go.Isosurface(
x=coord_mesh[:,0],
y= coord_mesh[:,1],
z = coord_mesh[:,2],
value=data,
caps=dict(x_show=False, y_show=False, z_show=False),
spaceframe=dict(show=False),
surface=dict(count=1),
isomin =ISOVAL,
isomax=ISOVAL,
cmin=data_min,
cmax=data_max,
lighting=
dict(
ambient=0.3,
diffuse=1,
fresnel=0,
roughness=1,
specular=1
),
lightposition=dict(
x=0,
y=0,
z=1.75)
)
)
fig.show()
As you can see, the fourth dimension (data) within the cuboidal region is just the z-axis value EXCEPT in a cylindrical region at the center, where the data is replaced with DATA_REPLACE .
The output expected is a plane parallel to x-y with a circular hole in the middle.
The actual output:
The cylindrical boundary rising up is NOT expected behaviour. The value is not "6" or even close to 6 over that cylinder.
This is not simply a case of missing data, or incorrect imputation of missing data. This can affect any plot where the isosurface has a hole.
My intuition is that the code for computing the mesh expects that:
- The mesh should be a closed surface
OR - Any holes in the mesh should exist at the boundaries of the cuboidal domain.
To me this feels like a generalization of plotly/plotly.js#4192
Thanks,
AKB
PS: If you are already on this / if this is a duplicate issue / it doesn't fit the issue format, sorry for wasting your time.
