@@ -1184,7 +1184,7 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
11841184 "colors" , "linestyles" ])
11851185 @_docstring .dedent_interpd
11861186 def eventplot (self , positions , orientation = 'horizontal' , lineoffsets = 1 ,
1187- linelengths = 1 , linewidths = None , colors = None ,
1187+ linelengths = 1 , linewidths = None , colors = None , alpha = None ,
11881188 linestyles = 'solid' , ** kwargs ):
11891189 """
11901190 Plot identical parallel lines at the given positions.
@@ -1246,6 +1246,13 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
12461246 If *positions* is 2D, this can be a sequence with length matching
12471247 the length of *positions*.
12481248
1249+ alpha : float or array-like, default: 1
1250+ The alpha blending value(s), between 0 (transparent) and 1
1251+ (opaque).
1252+
1253+ If *positions* is 2D, this can be a sequence with length matching
1254+ the length of *positions*.
1255+
12491256 linestyles : str or tuple or list of such values, default: 'solid'
12501257 Default is 'solid'. Valid strings are ['solid', 'dashed',
12511258 'dashdot', 'dotted', '-', '--', '-.', ':']. Dash tuples
@@ -1273,8 +1280,8 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
12731280
12741281 Notes
12751282 -----
1276- For *linelengths*, *linewidths*, *colors*, and *linestyles*, if only
1277- a single value is given, that value is applied to all lines. If an
1283+ For *linelengths*, *linewidths*, *colors*, *alpha* and *linestyles*, if
1284+ only a single value is given, that value is applied to all lines. If an
12781285 array-like is given, it must have the same length as *positions*, and
12791286 each value will be applied to the corresponding row of the array.
12801287
@@ -1316,6 +1323,8 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
13161323 linewidths = [linewidths ]
13171324 if not np .iterable (colors ):
13181325 colors = [colors ]
1326+ if not np .iterable (alpha ):
1327+ alpha = [alpha ]
13191328 if hasattr (linestyles , 'lower' ) or not np .iterable (linestyles ):
13201329 linestyles = [linestyles ]
13211330
@@ -1352,8 +1361,9 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
13521361 if len (linewidths ) == 1 :
13531362 linewidths = np .tile (linewidths , len (positions ))
13541363 if len (colors ) == 1 :
1355- colors = list (colors )
1356- colors = colors * len (positions )
1364+ colors = list (colors ) * len (positions )
1365+ if len (alpha ) == 1 :
1366+ alpha = list (alpha ) * len (positions )
13571367 if len (linestyles ) == 1 :
13581368 linestyles = [linestyles ] * len (positions )
13591369
@@ -1369,20 +1379,25 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
13691379 if len (colors ) != len (positions ):
13701380 raise ValueError ('colors and positions are unequal sized '
13711381 'sequences' )
1382+ if len (alpha ) != len (positions ):
1383+ raise ValueError ('alpha and positions are unequal sized '
1384+ 'sequences' )
13721385 if len (linestyles ) != len (positions ):
13731386 raise ValueError ('linestyles and positions are unequal sized '
13741387 'sequences' )
13751388
13761389 colls = []
1377- for position , lineoffset , linelength , linewidth , color , linestyle in \
1390+ for position , lineoffset , linelength , linewidth , color , alpha_ , \
1391+ linestyle in \
13781392 zip (positions , lineoffsets , linelengths , linewidths ,
1379- colors , linestyles ):
1393+ colors , alpha , linestyles ):
13801394 coll = mcoll .EventCollection (position ,
13811395 orientation = orientation ,
13821396 lineoffset = lineoffset ,
13831397 linelength = linelength ,
13841398 linewidth = linewidth ,
13851399 color = color ,
1400+ alpha = alpha_ ,
13861401 linestyle = linestyle )
13871402 self .add_collection (coll , autolim = False )
13881403 coll ._internal_update (kwargs )
0 commit comments