8000 Remove casting to array in EventCollection to preserve unit handling · matplotlib/matplotlib@14c6460 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 14c6460

Browse files
committed
Remove casting to array in EventCollection to preserve unit handling
1 parent 09565a5 commit 14c6460

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/matplotlib/collections.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,10 +1310,9 @@ def __init__(self,
13101310

13111311
segment = (lineoffset + linelength / 2.,
13121312
lineoffset - linelength / 2.)
1313-
positions = np.asarray(positions)
1314-
if len(positions) == 0:
1313+
if positions is None or len(positions) == 0:
13151314
segments = []
1316-
elif positions.ndim > 1:
1315+
elif hasattr(positions, 'ndim') and positions.ndim > 1:
13171316
raise ValueError('positions cannot have a dimensionality greater '
13181317
'than 1 (in the ndarray sense)')
13191318
elif (orientation is None or orientation.lower() == 'none' or

0 commit comments

Comments
 (0)
0