To get a code working for you data, please, comment out these two lines:
tmp = np.linspace(-2,2,51)
x,y = np.meshgrid(tmp,tmp)
and replace them by:
xm, xM = X[:,0].min(), X[:, 0].max()
ym, yM = X[:,1].min(), X[:, 1].max()
x = np.linspace(xm, xM, 10)
y = np.linspace(ym, yM, 10)
x, y =np.meshgrid(x, y)
The last lines of code extracted the x- values, respectively y-values range. Then it is defined a meshgrid over the rectangle [xm, xM] x [ym, yM]
and evaluated (via z(x,y) )the separating plane equation at the points of this grid, to get data for a go.Surface, that represents the plane.
I replaced the βGreysβ colorscale with a simple one (there is no reason to color the separating plane darker in its upper part):
my_colorscale =
[[0, βrgb(230,230,230)β], [1, βrgb(230,230,230)β]]`,
and added opacity =0.9:
fig.add_surface(x=x, y=y, z=z(x,y), colorscale=my_colorscale, showscale=False, opacity=0.9)
and finally updated layout to width=800, height=800.