From b3e9c52a02853e11f86be617c69709c6eb6fd1dd Mon Sep 17 00:00:00 2001
From: Philipp Rudiger
Date: Fri, 14 Apr 2017 16:23:43 +0100
Subject: [PATCH 1/3] Added unit test for applying methods to Annotations
---
tests/testannotations.py | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/tests/testannotations.py b/tests/testannotations.py
index 627c23e484..71e22ce29a 100644
--- a/tests/testannotations.py
+++ b/tests/testannotations.py
@@ -1,6 +1,6 @@
import numpy as np
-from holoviews import Image, HLine, VLine
+from holoviews import Image, HLine, VLine, Text, Arrow, Annotation
from holoviews.element.comparison import ComparisonTestCase
class AnnotationTests(ComparisonTestCase):
@@ -18,3 +18,15 @@ def test_vline_dimension_values(self):
hline = VLine(0)
self.assertEqual(hline.range(0), (0, 0))
self.assertEqual(hline.range(1), (None, None))
+
+ def test_deep_clone_map_select_redim(self):
+ annotations = (Text(0, 0, 'A') + Arrow(0, 0) + HLine(0) + VLine(0))
+ selected = annotations.select(x=(0, 5))
+ redimmed = selected.redim(x='z')
+ relabelled = redimmed.relabel(label='foo', depth=5)
+ mapped = relabelled.map(lambda x: x.clone(group='bar'), Annotation)
+ kwargs = dict(label='foo', group='bar', extents=(0, None, 5, None), kdims=['z', 'y'])
+ self.assertEqual(mapped.Text.I, Text(0, 0, 'A', **kwargs))
+ self.assertEqual(mapped.Arrow.I, Arrow(0, 0, **kwargs))
+ self.assertEqual(mapped.HLine.I, HLine(0, **kwargs))
+ self.assertEqual(mapped.VLine.I, VLine(0, **kwargs))
From 13baddf35e8fb94bb1c5e623ff41867a2b4d373c Mon Sep 17 00:00:00 2001
From: Philipp Rudiger
Date: Fri, 14 Apr 2017 16:24:57 +0100
Subject: [PATCH 2/3] Added KeyError when slicing a Layout
---
holoviews/core/layout.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/holoviews/core/layout.py b/holoviews/core/layout.py
index c7e80ef18b..6d2c7ffa7a 100644
--- a/holoviews/core/layout.py
+++ b/holoviews/core/layout.py
@@ -529,6 +529,9 @@ def __getitem__(self, key):
if key < len(self):
return self.data.values()[key]
raise KeyError("Element out of range.")
+ elif isinstance(key, slice):
+ raise KeyError("A Layout may not be sliced, ensure that you "
+ "are slicing on a leaf (i.e. not a branch) of the Layout.")
if len(key) == 2 and not any([isinstance(k, str) for k in key]):
if key == (slice(None), slice(None)): return self
row, col = key
From 3c83f7e889ad9b75fe0e1825fc75e28aedaad3d5 Mon Sep 17 00:00:00 2001
From: Philipp Rudiger
Date: Fri, 14 Apr 2017 16:51:36 +0100
Subject: [PATCH 3/3] Updated default datashade type from GridImage to Image
---
holoviews/operation/datashader.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/holoviews/operation/datashader.py b/holoviews/operation/datashader.py
index 48e2c52c5b..9d8e35c761 100644
--- a/holoviews/operation/datashader.py
+++ b/holoviews/operation/datashader.py
@@ -22,7 +22,7 @@
Overlay, CompositeOverlay, Dataset)
from ..core.data import PandasInterface, DaskInterface
from ..core.util import get_param_values, basestring
-from ..element import GridImage, Image, Path, Curve, Contours, RGB
+from ..element import Image, Path, Curve, Contours, RGB
from ..streams import RangeXY
@@ -117,7 +117,7 @@ class aggregate(ElementOperation):
for dynamic interaction with the plot.""")
element_type = param.ClassSelector(class_=(Dataset,), instantiate=False,
- is_instance=False, default=GridImage,
+ is_instance=False, default=Image,
doc="""
The type of the returned Elements, must be a 2D Dataset type.""")
@@ -267,7 +267,7 @@ class shade(ElementOperation):
@classmethod
def concatenate(cls, overlay):
"""
- Concatenates an NdOverlay of GridImage types into a single 3D
+ Concatenates an NdOverlay of Image types into a single 3D
xarray Dataset.
"""
if not isinstance(overlay, NdOverlay):
@@ -409,10 +409,10 @@ def _apply_dynspread(self, array):
how=self.p.how, shape=self.p.shape).data
def _process(self, element, key=None):
- if not isinstance(element, (Image, GridImage)):
+ if not isinstance(element, Image):
raise ValueError('dynspread can only be applied to Image Elements.')
- if isinstance(element, GridImage):
+ if isinstance(element, Image):
new_data = {kd.name: element.dimension_values(kd, expanded=False)
for kd in element.kdims}
for vd in element.vdims: