@@ -1251,7 +1251,7 @@ class EventCollection(LineCollection):
1251
1251
_edge_default = True
1252
1252
1253
1253
def __init__ (self ,
1254
- positions , # Can be None.
1254
+ positions , # Cannot be None.
1255
1255
orientation = None ,
1256
1256
lineoffset = 0 ,
1257
1257
linelength = 1 ,
@@ -1264,7 +1264,7 @@ def __init__(self,
1264
1264
"""
1265
1265
Parameters
1266
1266
----------
1267
- positions : 1D array-like object or None .
1267
+ positions : 1D array-like object.
1268
1268
Each value is an event.
1269
1269
1270
1270
orientation : [ None (default) | 'horizontal' | 'vertical'], optional.
@@ -1286,9 +1286,8 @@ def __init__(self,
1286
1286
If it is None, defaults to its rcParams setting, in sequence form.
1287
1287
1288
1288
linestyle : str or tuple, optional. Default is 'solid'.
1289
- If it is a string, it has to be among [ 'solid' | 'dashed' |
1290
- 'dashdot' | 'dotted' | '-' | '--' | '-.' | ':' ]. If it is a dash
1291
- tuple, it has to be of the form::
1289
+ Valid strings are [ 'solid' | 'dashed' | 'dashdot' | 'dotted' |
1290
+ '-' | '--' | '-.' | ':' ]. Dash tuples have to be of the form::
1292
1291
1293
1292
(offset, onoffseq),
1294
1293
@@ -1311,11 +1310,12 @@ def __init__(self,
1311
1310
1312
1311
segment = (lineoffset + linelength / 2. ,
1313
1312
lineoffset - linelength / 2. )
1314
- if positions is None or len (positions ) == 0 :
1313
+ positions = np .asarray (positions )
1314
+ if len (positions ) == 0 :
1315
1315
segments = []
1316
- elif hasattr ( positions , 'ndim' ) and positions .ndim > 1 :
1317
- raise ValueError ('if positions is an ndarray it cannot have '
1318
- 'dimensionality strictly greater than 1 ' )
1316
+ elif positions .ndim > 1 :
1317
+ raise ValueError ('positions cannot have a dimensionality greater '
1318
+ 'than 1 (in the ndarray sense) ' )
1319
1319
elif (orientation is None or orientation .lower () == 'none' or
1320
1320
orientation .lower () == 'horizontal' ):
1321
1321
positions .sort ()
0 commit comments