Skip to content

Commit

Permalink
Implemented correct Raster.range
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Apr 8, 2017
1 parent 6a1b38e commit 03d13ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 1 addition & 3 deletions holoviews/core/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,9 +970,7 @@ def range(self, dimension, data_range=True):
range_fn = lambda x: x.range(dname)
ranges = self.traverse(range_fn, [match_fn])
drange = max_range(ranges)
soft_range = [r for r in dimension.soft_range if r is not None]
if soft_range:
drange = util.max_range([drange, soft_range])
drange = max_range([drange, dimension.soft_range])
else:
drange = dim.soft_range
if dimension.range[0] is not None:
Expand Down
17 changes: 16 additions & 1 deletion holoviews/element/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Overlay, Element, Dataset, NdElement)
from ..core.boundingregion import BoundingRegion, BoundingBox
from ..core.sheetcoords import SheetCoordinateSystem
from ..core.util import pd
from ..core.util import pd, max_range
from .chart import Curve
from .tabular import Table
from .util import compute_edges, compute_slice_bounds, categorical_aggregate2d
Expand Down Expand Up @@ -76,6 +76,21 @@ def __getitem__(self, slices):
extents=None)


def range(self, dim, data_range=True):
idx = self.get_dimension_index(dim)
if data_range and idx == 2:
dimension = self.get_dimension(dim)
drange = self.data.min(), self.data.max()
drange = max_range([drange, dimension.soft_range])
if dimension.range[0] is not None:
return (dimension.range[0], drange[1])
elif dimension.range[1] is not None:
return (drange[0], dimension.range[1])
else:
return drange
return super(Raster, self).range(dim, data_range)


def dimension_values(self, dim, expanded=True, flat=True):
"""
The set of samples available along a particular dimension.
Expand Down

0 comments on commit 03d13ee

Please sign in to comment.