Skip to content

Commit

Permalink
Skip empty chords
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Dec 14, 2017
1 parent 0b3988c commit 4f4e91d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 8 additions & 1 deletion holoviews/element/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,21 @@ def _process(self, element, key=None):
src_area, tgt_area = all_areas[src_idx[i]], all_areas[tgt_idx[i]]
subpaths = []
for _ in range(int(values[i])):
if not src_area or not tgt_area:
continue
x0, y0 = src_area.pop()
if not tgt_area:
continue
x1, y1 = tgt_area.pop()
b = quadratic_bezier((x0, y0), (x1, y1), (x0/2., y0/2.),
(x1/2., y1/2.), steps=self.p.chord_samples)
subpaths.append(b)
subpaths.append(empty)
subpaths = [p for p in subpaths[:-1] if len(p)]
if subpaths:
paths.append(np.concatenate(subpaths[:-1]))
paths.append(np.concatenate(subpaths))
else:
paths.append(np.array([]))

# Construct Chord element from components
if nodes_el:
Expand Down
1 change: 0 additions & 1 deletion holoviews/plotting/bokeh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
Table, ItemTable, Area, HSV, QuadMesh, VectorField,
Graph, Nodes, EdgePaths, Distribution, Bivariate,
TriMesh, Chord)
>>>>>>> Implemented Chord element and plots
from ...core.options import Options, Cycle, Palette
from ...core.util import VersionError

Expand Down

0 comments on commit 4f4e91d

Please sign in to comment.