Skip to content

Commit

Permalink
lines2gfx: speed-up matching colors to line segments
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed May 8, 2024
1 parent f3220ac commit d3272f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions octarine/visuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ def lines2gfx(lines, color, linewidth=1, linewidth_space="screen", dash_pattern=
# See if we can rescue this
if len(color) == n_points:
breaks = np.where(np.isnan(lines[:, 0]))[0]
for b in breaks:
color = np.insert(color, b, np.nan, axis=0)
offset = np.arange(len(breaks))
color = np.insert(color, breaks-offset, np.nan, axis=0)
else:
raise ValueError(f"Got {len(color)} colors for {n_points} points.")
color = color.astype(np.float32, copy=False)
Expand Down

0 comments on commit d3272f9

Please sign in to comment.