Repository: holoviz/holoviews

Issue:
legend not correct anymore in area chart example
Something changed in the behavior of .relabel() in HoloViews 1.13 that it influences the legend in the area_chart example. Same is for the stacked example.

Old version seems correct: 
http://holoviews.org/gallery/demos/bokeh/area_chart.html

<img src="https://user-images.githubusercontent.com/7305600/72728057-c4b6dc80-3b8c-11ea-8f29-0949bea0bd99.png"  width="300"/>

New version looks like this:
http://build.holoviews.org/gallery/demos/bokeh/area_chart.html

<img src="https://user-images.githubusercontent.com/7305600/72728104-e1531480-3b8c-11ea-96e7-e5dc9804c912.png"  width="300"/>


Code example:
```python
import numpy as np
import holoviews as hv
from holoviews import opts
hv.extension('bokeh')

python=np.array([2, 3, 7, 5, 26, 221, 44, 233, 254, 265, 266, 267, 120, 111])
pypy=np.array([12, 33, 47, 15, 126, 121, 144, 233, 254, 225, 226, 267, 110, 130])
jython=np.array([22, 43, 10, 25, 26, 101, 114, 203, 194, 215, 201, 227, 139, 160])

dims = dict(kdims='time', vdims='memory')
python = hv.Area(python, label='python', **dims)
pypy   = hv.Area(pypy,   label='pypy',   **dims)
jython = hv.Area(jython, label='jython', **dims)

opts.defaults(opts.Area(fill_alpha=0.5))
overlay = (python * pypy * jython)
overlay.relabel("Area Chart")  # the relabel changes the legend in the new example
```




Discussion:

Resolving patch:
diff --git a/holoviews/core/dimension.py b/holoviews/core/dimension.py
--- a/holoviews/core/dimension.py
+++ b/holoviews/core/dimension.py
@@ -12,7 +12,7 @@
 from operator import itemgetter
 from collections import defaultdict, Counter
 from itertools import chain
-from functools import reduce, partial
+from functools import partial
 
 import param
 import numpy as np
@@ -1456,38 +1456,5 @@ def dimension_values(self, dimension, expanded=True, flat=True):
             return super(ViewableTree, self).dimension_values(
                 dimension, expanded, flat)
 
-
-    def regroup(self, group):
-        """Deprecated method to apply new group to items.
-
-        Equivalent functionality possible using:
-
-            ViewableTree(tree.relabel(group='Group').values())
-        """
-        self.param.warning('%s.regroup is deprecated, use relabel '
-                           'method with a group argument instead.'
-                           % type(self).__name__)
-        new_items = [el.relabel(group=group) for el in self.data.values()]
-        return reduce(lambda x,y: x+y, new_items)
-
-
-    def relabel(self, label=None, group=None, depth=1):
-        """Clone object and apply new group and/or label.
-
-        Applies relabeling to children up to the supplied depth.
-
-        Args:
-            label (str, optional): New label to apply to returned object
-            group (str, optional): New group to apply to returned object
-            depth (int, optional): Depth to which relabel will be applied
-                If applied to container allows applying relabeling to
-                contained objects up to the specified depth
-
-        Returns:
-            Returns relabelled object
-        """
-        return super(ViewableTree, self).relabel(label, group, depth)
-
-    
     def __len__(self):
         return len(self.data)
diff --git a/holoviews/core/layout.py b/holoviews/core/layout.py
--- a/holoviews/core/layout.py
+++ b/holoviews/core/layout.py
@@ -498,6 +498,22 @@ def cols(self, ncols):
         self._max_cols = ncols
         return self
 
+    def relabel(self, label=None, group=None, depth=1):
+        """Clone object and apply new group and/or label.
+
+        Applies relabeling to children up to the supplied depth.
+
+        Args:
+            label (str, optional): New label to apply to returned object
+            group (str, optional): New group to apply to returned object
+            depth (int, optional): Depth to which relabel will be applied
+                If applied to container allows applying relabeling to
+                contained objects up to the specified depth
+
+        Returns:
+            Returns relabelled object
+        """
+        return super(Layout, self).relabel(label, group, depth)
 
     def grid_items(self):
         return {tuple(np.unravel_index(idx, self.shape)): (path, item)


Test patch:
diff --git a/holoviews/tests/core/testcomposites.py b/holoviews/tests/core/testcomposites.py
--- a/holoviews/tests/core/testcomposites.py
+++ b/holoviews/tests/core/testcomposites.py
@@ -296,7 +296,7 @@ def test_overlay_constructor2(self):
 
     def test_overlay_group(self):
         t1 = (self.el1 * self.el2)
-        t2 = Overlay(list(t1.relabel(group='NewValue')))
+        t2 = Overlay(list(t1.relabel(group='NewValue', depth=1)))
         self.assertEqual(t2.keys(), [('NewValue', 'I'), ('NewValue', 'II')])
 
     def test_overlay_quadruple_1(self):