@@ -1455,8 +1455,8 @@ class EventCollection(LineCollection):
14551455 _edge_default = True
14561456
14571457 def __init__ (self ,
1458- positions , # Cannot be None.
1459- orientation = None ,
1458+ positions , # Cannot be None.
1459+ orientation = 'horizontal' ,
14601460 lineoffset = 0 ,
14611461 linelength = 1 ,
14621462 linewidth = None ,
@@ -1471,10 +1471,9 @@ def __init__(self,
14711471 positions : 1D array-like
14721472 Each value is an event.
14731473
1474- orientation : {None, 'horizontal', 'vertical'}, optional
1474+ orientation : {'horizontal', 'vertical'}, default: 'horizontal'
14751475 The orientation of the **collection** (the event bars are along
1476- the orthogonal direction). Defaults to 'horizontal' if not
1477- specified or None.
1476+ the orthogonal direction).
14781477
14791478 lineoffset : scalar, default: 0
14801479 The offset of the center of the markers from the origin, in the
@@ -1584,17 +1583,26 @@ def set_orientation(self, orientation=None):
15841583
15851584 Parameters
15861585 ----------
1587- orientation: {'horizontal', 'vertical'} or None
1588- Defaults to 'horizontal' if not specified or None.
1589- """
1590- if (orientation is None or orientation .lower () == 'none' or
1591- orientation .lower () == 'horizontal' ):
1592- is_horizontal = True
1593- elif orientation .lower () == 'vertical' :
1594- is_horizontal = False
1595- else :
1596- cbook ._check_in_list (['horizontal' , 'vertical' ],
1597- orientation = orientation )
1586+ orientation : {'horizontal', 'vertical'}
1587+ """
1588+ try :
1589+ is_horizontal = cbook ._check_getitem (
1590+ {"horizontal" : True , "vertical" : False },
1591+ orientation = orientation )
1592+ except ValueError :
1593+ if (orientation is None or orientation .lower () == "none"
1594+ or orientation .lower () == "horizontal" ):
1595+ is_horizontal = True
1596+ elif orientation .lower () == "vertical" :
1597+ is_horizontal = False
1598+ else :
1599+ raise
1600+ normalized = "horizontal" if is_horizontal else "vertical"
1601+ cbook .warn_deprecated (
1602+ "3.3" , message = "Support for setting the orientation of "
1603+ f"EventCollection to { orientation !r} is deprecated since "
1604+ f"%(since)s and will be removed %(removal)s; please set it to "
1605+ f"{ normalized !r} instead." )
15981606 if is_horizontal == self .is_horizontal ():
15991607 return
16001608 self .switch_orientation ()
0 commit comments