Skip to content

Commit

Permalink
Fix fix error when converting histogram to curve
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Aug 20, 2019
1 parent e2042cb commit 3dd3f1e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 8 additions & 3 deletions holoviews/core/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,21 +490,26 @@ def __init__(self, data, id=None, plot_id=None, **params):
self.data = data

# Handle initializing the dataset property.
self._dataset = None
input_dataset = params.pop('dataset', None)
if type(self) is Dataset:
self._dataset = self
elif input_dataset is not None:
# Clone dimension info from input dataset with reference to new
# data. This way we keep the metadata for all of the dimensions.
self._dataset = input_dataset.clone(data=self.data)
else:
try:
self._dataset = input_dataset.clone(data=self.data)
except DataError:
# Dataset not compatible with input data
pass
if self._dataset is None:
# Create a default Dataset to wrap input data
try:
self._dataset = Dataset(self.data)
except DataError:
# Data not supported by any storage backend. leave _dataset as
# None
self._dataset = None
pass

self._id = None
self.id = id
Expand Down
4 changes: 4 additions & 0 deletions holoviews/tests/core/testdatasetproperty.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@ def test_select_multi(self):
sub_hist.dataset,
self.ds.select(a=(1, None))
)

def test_hist_to_curve(self):
# No exception thrown
self.hist.to.curve()

0 comments on commit 3dd3f1e

Please sign in to comment.