Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c66add5

Browse files
committed
Fixed eventplot issues
1 parent f393802 commit c66add5

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,15 +1261,12 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
12611261

12621262
# fix positions, noting that it can be a list of lists:
12631263
if not np.iterable(positions):
1264-
positions = [positions]
1264+
positions = [np.asanyarray([positions])]
12651265
elif any(np.iterable(position) for position in positions):
12661266
positions = [np.asanyarray(position) for position in positions]
12671267
else:
12681268
positions = [np.asanyarray(positions)]
12691269

1270-
if len(positions) == 0:
1271-
return []
1272-
12731270
poss = []
12741271
for position in positions:
12751272
poss += self._process_unit_info([("x", position)], kwargs)
@@ -1297,15 +1294,15 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
12971294
linewidths = np.asarray(linewidths)
12981295

12991296
if len(lineoffsets) == 0:
1300-
lineoffsets = [None]
1297+
raise ValueError('lineoffsets cannot be empty')
13011298
if len(linelengths) == 0:
1302-
linelengths = [None]
1303-
if len(linewidths) == 0:
1304-
lineoffsets = [None]
1299+
raise ValueError('linelengths cannot be empty')
13051300
if len(linewidths) == 0:
1306-
lineoffsets = [None]
1301+
raise ValueError('linewidths cannot be empty')
13071302
if len(colors) == 0:
1308-
colors = [None]
1303+
raise ValueError('colors cannot be empty')
1304+
if len(linestyles) == 0:
1305+
raise ValueError('linestyles cannot be empty')
13091306
try:
13101307
# Early conversion of the colors into RGBA values to take care
13111308
# of cases like colors='0.5' or colors='C1'. (Issue #8193)

0 commit comments

Comments
 (0)