@@ -1184,7 +1184,7 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
1184
1184
"colors" , "linestyles" ])
1185
1185
@_docstring .dedent_interpd
1186
1186
def eventplot (self , positions , orientation = 'horizontal' , lineoffsets = 1 ,
1187
- linelengths = 1 , linewidths = None , colors = None ,
1187
+ linelengths = 1 , linewidths = None , colors = None , alpha = None ,
1188
1188
linestyles = 'solid' , ** kwargs ):
1189
1189
"""
1190
1190
Plot identical parallel lines at the given positions.
@@ -1246,6 +1246,12 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
1246
1246
If *positions* is 2D, this can be a sequence with length matching
1247
1247
the length of *positions*.
1248
1248
1249
+ alpha : float or array-like, default: 1
1250
+ The alpha blending value(s), between 0 (transparent) and 1 (opaque).
1251
+
1252
+ If *positions* is 2D, this can be a sequence with length matching
1253
+ the length of *positions*.
1254
+
1249
1255
linestyles : str or tuple or list of such values, default: 'solid'
1250
1256
Default is 'solid'. Valid strings are ['solid', 'dashed',
1251
1257
'dashdot', 'dotted', '-', '--', '-.', ':']. Dash tuples
@@ -1316,6 +1322,8 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
1316
1322
linewidths = [linewidths ]
1317
1323
if not np .iterable (colors ):
1318
1324
colors = [colors ]
1325
+ if not np .iterable (alpha ):
1326
+ alpha = [alpha ]
1319
1327
if hasattr (linestyles , 'lower' ) or not np .iterable (linestyles ):
1320
1328
linestyles = [linestyles ]
1321
1329
@@ -1352,8 +1360,9 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
1352
1360
if len (linewidths ) == 1 :
1353
1361
linewidths = np .tile (linewidths , len (positions ))
1354
1362
if len (colors ) == 1 :
1355
- colors = list (colors )
1356
- colors = colors * len (positions )
1363
+ colors = list (colors ) * len (positions )
1364
+ if len (alpha ) == 1 :
1365
+ alpha = list (alpha ) * len (positions )
1357
1366
if len (linestyles ) == 1 :
1358
1367
linestyles = [linestyles ] * len (positions )
1359
1368
@@ -1369,20 +1378,25 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
1369
1378
if len (colors ) != len (positions ):
1370
1379
raise ValueError ('colors and positions are unequal sized '
1371
1380
'sequences' )
1381
+ if len (alpha ) != len (positions ):
1382
+ raise ValueError ('alpha and positions are unequal sized '
1383
+ 'sequences' )
1372
1384
if len (linestyles ) != len (positions ):
1373
1385
raise ValueError ('linestyles and positions are unequal sized '
1374
1386
'sequences' )
1375
1387
1376
1388
colls = []
1377
- for position , lineoffset , linelength , linewidth , color , linestyle in \
1389
+ for position , lineoffset , linelength , linewidth , color , alpha_ , \
1390
+ linestyle in \
1378
1391
zip (positions , lineoffsets , linelengths , linewidths ,
1379
- colors , linestyles ):
1392
+ colors , alpha , linestyles ):
1380
1393
coll = mcoll .EventCollection (position ,
1381
1394
orientation = orientation ,
1382
1395
lineoffset = lineoffset ,
1383
1396
linelength = linelength ,
1384
1397
linewidth = linewidth ,
1385
1398
color = color ,
1399
+ alpha = alpha_ ,
1386
1400
linestyle = linestyle )
1387
1401
self .add_collection (coll , autolim = False )
1388
1402
coll ._internal_update (kwargs )
0 commit comments