Skip to content

Commit

Permalink
Fixed bokeh graph plot test
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Feb 13, 2018
1 parent 383690d commit 4cf953f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion holoviews/core/data/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def values(cls, dataset, dim, expanded=True, flat=True):
else:
if not expanded:
return util.unique_array(values)
values = np.array(values)
values = np.asarray(values)
return values


Expand Down
5 changes: 4 additions & 1 deletion holoviews/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,10 @@ def unique_array(arr):
if not len(arr):
return arr
elif pd:
return pd.unique(arr)
unique = pd.unique(arr)
if isinstance(arr, np.ndarray) and unique.dtype != arr.dtype:
return unique.astype(arr.dtype)
return unique
else:
arr = np.asarray(arr)
_, uniq_inds = np.unique(arr, return_index=True)
Expand Down
1 change: 1 addition & 0 deletions holoviews/plotting/bokeh/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def _get_edge_colors(self, element, ranges, edge_data, edge_mapping, style):
field = dimension_sanitizer(cdim.name)
cvals = element.dimension_values(cdim)
if idx in self._node_columns:
print(element.nodes.interface)
factors = element.nodes.dimension_values(2, expanded=False)
elif idx == 2 and cvals.dtype.kind in 'if':
factors = None
Expand Down
2 changes: 1 addition & 1 deletion tests/testbokehgraphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def setUp(self):
self.weights = np.random.rand(N)
self.graph = Graph(((self.source, self.target),))
self.node_info = Dataset(['Output']+['Input']*(N-1), vdims=['Label'])
self.node_info2 = Dataset(self.weights, vdims='Weight')
self.node_info2 = Dataset(self.weights, vdims='Weight', datatype=['dictionary'])
self.graph2 = Graph(((self.source, self.target), self.node_info))
self.graph3 = Graph(((self.source, self.target), self.node_info2), datatype=['dictionary'])
self.graph4 = Graph(((self.source, self.target, self.weights),), vdims='Weight')
Expand Down

0 comments on commit 4cf953f

Please sign in to comment.