The 'plot' method now returns a HoloMap that contains Images
of the different levels. Calling 'learner.plot().layout()' will
return the plots beside each other.
... | ... |
@@ -386,9 +386,6 @@ class Learner2D(BaseLearner): |
386 | 386 |
|
387 | 387 |
def plot(self, n=None, tri_alpha=0): |
388 | 388 |
hv = ensure_holoviews() |
389 |
- if self.vdim > 1: |
|
390 |
- raise NotImplementedError('holoviews currently does not support', |
|
391 |
- '3D surface plots in bokeh.') |
|
392 | 389 |
x, y = self.bounds |
393 | 390 |
lbrt = x[0], y[0], x[1], y[1] |
394 | 391 |
|
... | ... |
@@ -404,7 +401,12 @@ class Learner2D(BaseLearner): |
404 | 401 |
x = y = np.linspace(-0.5, 0.5, n) |
405 | 402 |
z = ip(x[:, None], y[None, :] * self.aspect_ratio).squeeze() |
406 | 403 |
|
407 |
- im = hv.Image(np.rot90(z), bounds=lbrt) |
|
404 |
+ if self.vdim > 1: |
|
405 |
+ ims = {i: hv.Image(np.rot90(z[:, :, i]), bounds=lbrt) |
|
406 |
+ for i in range(z.shape[-1])} |
|
407 |
+ im = hv.HoloMap(ims) |
|
408 |
+ else: |
|
409 |
+ im = hv.Image(np.rot90(z), bounds=lbrt) |
|
408 | 410 |
|
409 | 411 |
if tri_alpha: |
410 | 412 |
points = self._unscale(ip.tri.points[ip.tri.vertices]) |