Browse code

2D: add a doc-string to the 'plot' method

Bas Nijholt authored on 12/05/2018 19:16:47
Showing 1 changed files
... ...
@@ -385,6 +385,33 @@ class Learner2D(BaseLearner):
385 385
                 self._stack[p] = np.inf
386 386
 
387 387
     def plot(self, n=None, tri_alpha=0):
388
+        """Plot the Learner2D's current state.
389
+
390
+        This plot function interpolates the data on a regular grid.
391
+        The gridspacing is evaluated by checking the size of the smallest
392
+        triangle.
393
+
394
+        Parameters
395
+        ----------
396
+        n : int
397
+            Number of points in x and y. If None (default) this number is
398
+            evaluated by looking at the size of the smallest triangle.
399
+        tri_alpha : float
400
+            The opacity (0 <= tri_alpha <= 1) of the triangles overlayed on
401
+            top of the image. By default the triangulation is not visible.
402
+
403
+        Returns
404
+        -------
405
+        plot : holoviews.Overlay or holoviews.HoloMap
406
+            A `holoviews.Overlay` of `holoviews.Image * holoviews.EdgePaths`.
407
+            If the `learner.function` returns a vector output, a
408
+            `holoviews.HoloMap` of the `holoviews.Overlay`s wil be returned.
409
+
410
+        Notes
411
+        -----
412
+        The plot object that is returned if `learner.function` returns a
413
+        vector *cannot* be used with the live_plotting functionality.
414
+        """
388 415
         hv = ensure_holoviews()
389 416
         x, y = self.bounds
390 417
         lbrt = x[0], y[0], x[1], y[1]