Skip to content
Snippets Groups Projects

Resolve "(LearnerND) add iso-surface plot feature"

Merged Jorn Hoofwijk requested to merge 112-learnernd-add-iso-surface-plot-feature into master
Compare and Show latest version
1 file
+ 6
2
Compare changes
  • Side-by-side
  • Inline
@@ -665,13 +665,15 @@ class LearnerND(BaseLearner):
fig = plotly.figure_factory.create_trisurf(
x=x, y=y, z=z, plot_edges=False,
simplices=faces, title="Isosurface")
isosurface = fig.data[0]
isosurface.update(lighting=dict(ambient=1, diffuse=1, roughness=1, specular=0, fresnel=0))
if hull_opacity < 1e-3:
# Do not compute the hull_mesh.
return plotly.offline.iplot(fig)
hull_mesh = self._get_hull_mesh(opacity=hull_opacity)
return plotly.offline.iplot([fig.data[0], hull_mesh])
return plotly.offline.iplot([isosurface, hull_mesh])
def _get_hull_mesh(self, opacity=0.2):
plotly = ensure_plotly()
@@ -700,5 +702,7 @@ class LearnerND(BaseLearner):
x, y, z = zip(*self._bounds_points)
i, j, k = hull.simplices.T
lighting = dict(ambient=1, diffuse=1, roughness=1, specular=0, fresnel=0)
return plotly.graph_objs.Mesh3d(x=x, y=y, z=z, i=i, j=j, k=k,
facecolor=colors, opacity=opacity)
facecolor=colors, opacity=opacity,
lighting=lighting)
Loading