Skip to content

Commit fc212ee

Browse files
committed
revert changes from 3fb86c6 in favor of the opposite solution (+ minor changes)
1 parent 3fb86c6 commit fc212ee

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
11321132
linestyles : str or tuple or a sequence of such values, optional.
11331133
Default is 'solid'. Valid strings are [ 'solid' | 'dashed' |
11341134
'dashdot' | 'dotted' | '-' | '--' | '-.' | ':' ]. Dash tuples
1135-
have to follow::
1135+
have to be of the form::
11361136
11371137
(offset, onoffseq),
11381138
@@ -1169,9 +1169,6 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
11691169
lineoffsets = self.convert_yunits(lineoffsets)
11701170
linelengths = self.convert_yunits(linelengths)
11711171

1172-
if positions is None:
1173-
positions = []
1174-
11751172
if not iterable(positions):
11761173
positions = [positions]
11771174
elif any(iterable(position) for position in positions):

lib/matplotlib/collections.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ class EventCollection(LineCollection):
12511251
_edge_default = True
12521252

12531253
def __init__(self,
1254-
positions, # Can be None.
1254+
positions, # Cannot be None.
12551255
orientation=None,
12561256
lineoffset=0,
12571257
linelength=1,
@@ -1264,7 +1264,7 @@ def __init__(self,
12641264
"""
12651265
Parameters
12661266
----------
1267-
positions : 1D array-like object or None.
1267+
positions : 1D array-like object.
12681268
Each value is an event.
12691269
12701270
orientation : [ None (default) | 'horizontal' | 'vertical'], optional.
@@ -1286,9 +1286,8 @@ def __init__(self,
12861286
If it is None, defaults to its rcParams setting, in sequence form.
12871287
12881288
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::
12921291
12931292
(offset, onoffseq),
12941293
@@ -1311,11 +1310,12 @@ def __init__(self,
13111310

13121311
segment = (lineoffset + linelength / 2.,
13131312
lineoffset - linelength / 2.)
1314-
if positions is None or len(positions) == 0:
1313+
positions = np.asarray(positions)
1314+
if len(positions) == 0:
13151315
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)')
13191319
elif (orientation is None or orientation.lower() == 'none' or
13201320
orientation.lower() == 'horizontal'):
13211321
positions.sort()

0 commit comments

Comments
 (0)