@@ -2336,7 +2336,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23362336 if orientation == 'vertical' :
23372337 if y is None :
23382338 y = 0
2339- elif orientation == ' horizontal' :
2339+ else : # horizontal
23402340 if x is None :
23412341 x = 0
23422342
@@ -2345,7 +2345,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23452345 [("x" , x ), ("y" , height )], kwargs , convert = False )
23462346 if log :
23472347 self .set_yscale ('log' , nonpositive = 'clip' )
2348- elif orientation == ' horizontal' :
2348+ else : # horizontal
23492349 self ._process_unit_info (
23502350 [("x" , width ), ("y" , y )], kwargs , convert = False )
23512351 if log :
@@ -2374,7 +2374,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23742374 if orientation == 'vertical' :
23752375 tick_label_axis = self .xaxis
23762376 tick_label_position = x
2377- elif orientation == ' horizontal' :
2377+ else : # horizontal
23782378 tick_label_axis = self .yaxis
23792379 tick_label_position = y
23802380
@@ -2403,15 +2403,15 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
24032403 f'and width ({ width .dtype } ) '
24042404 f'are incompatible' ) from e
24052405 bottom = y
2406- elif orientation == ' horizontal' :
2406+ else : # horizontal
24072407 try :
24082408 bottom = y - height / 2
24092409 except TypeError as e :
24102410 raise TypeError (f'the dtypes of parameters y ({ y .dtype } ) '
24112411 f'and height ({ height .dtype } ) '
24122412 f'are incompatible' ) from e
24132413 left = x
2414- elif align == ' edge' :
2414+ else : # edge
24152415 left = x
24162416 bottom = y
24172417
@@ -2431,7 +2431,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
24312431 r .get_path ()._interpolation_steps = 100
24322432 if orientation == 'vertical' :
24332433 r .sticky_edges .y .append (b )
2434- elif orientation == ' horizontal' :
2434+ else : # horizontal
24352435 r .sticky_edges .x .append (l )
24362436 self .add_patch (r )
24372437 patches .append (r )
@@ -2442,7 +2442,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
24422442 ex = [l + 0.5 * w for l , w in zip (left , width )]
24432443 ey = [b + h for b , h in zip (bottom , height )]
24442444
2445- elif orientation == ' horizontal' :
2445+ else : # horizontal
24462446 # using list comps rather than arrays to preserve unit info
24472447 ex = [l + w for l , w in zip (left , width )]
24482448 ey = [b + 0.5 * h for b , h in zip (bottom , height )]
@@ -2459,7 +2459,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
24592459
24602460 if orientation == 'vertical' :
24612461 datavalues = height
2462- elif orientation == ' horizontal' :
2462+ else : # horizontal
24632463 datavalues = width
24642464
24652465 bar_container = BarContainer (patches , errorbar , datavalues = datavalues ,
@@ -2670,46 +2670,47 @@ def sign(x):
26702670 if orientation == "vertical" :
26712671 extrema = max (y0 , y1 ) if dat >= 0 else min (y0 , y1 )
26722672 length = abs (y0 - y1 )
2673- elif orientation == " horizontal" :
2673+ else : # horizontal
26742674 extrema = max (x0 , x1 ) if dat >= 0 else min (x0 , x1 )
26752675 length = abs (x0 - x1 )
26762676
26772677 if err is None or np .size (err ) == 0 :
26782678 endpt = extrema
26792679 elif orientation == "vertical" :
26802680 endpt = err [:, 1 ].max () if dat >= 0 else err [:, 1 ].min ()
2681- elif orientation == " horizontal" :
2681+ else : # horizontal
26822682 endpt = err [:, 0 ].max () if dat >= 0 else err [:, 0 ].min ()
26832683
26842684 if label_type == "center" :
26852685 value = sign (dat ) * length
2686- elif label_type == " edge" :
2686+ else : # edge
26872687 value = extrema
26882688
26892689 if label_type == "center" :
26902690 xy = xc , yc
2691- elif label_type == "edge" and orientation == "vertical" :
2692- xy = xc , endpt
2693- elif label_type == "edge" and orientation == "horizontal" :
2694- xy = endpt , yc
2691+ else : # edge
2692+ if orientation == "vertical" :
2693+ xy = xc , endpt
2694+ else : # horizontal
2695+ xy = endpt , yc
26952696
26962697 if orientation == "vertical" :
26972698 y_direction = - 1 if y_inverted else 1
26982699 xytext = 0 , y_direction * sign (dat ) * padding
2699- else :
2700+ else : # horizontal
27002701 x_direction = - 1 if x_inverted else 1
27012702 xytext = x_direction * sign (dat ) * padding , 0
27022703
27032704 if label_type == "center" :
27042705 ha , va = "center" , "center"
2705- elif label_type == " edge" :
2706+ else : # edge
27062707 if orientation == "vertical" :
27072708 ha = 'center'
27082709 if y_inverted :
27092710 va = 'top' if dat > 0 else 'bottom' # also handles NaN
27102711 else :
27112712 va = 'top' if dat < 0 else 'bottom' # also handles NaN
2712- elif orientation == " horizontal" :
2713+ else : # horizontal
27132714 if x_inverted :
27142715 ha = 'right' if dat > 0 else 'left' # also handles NaN
27152716 else :
@@ -2911,7 +2912,7 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
29112912
29122913 if orientation == 'vertical' :
29132914 locs , heads = self ._process_unit_info ([("x" , locs ), ("y" , heads )])
2914- else :
2915+ else : # horizontal
29152916 heads , locs = self ._process_unit_info ([("x" , heads ), ("y" , locs )])
29162917
29172918 # defaults for formats
@@ -7796,7 +7797,7 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
77967797 self .title .set_y (1.05 )
77977798 if origin == "upper" :
77987799 self .xaxis .tick_top ()
7799- else :
7800+ else : # lower
78007801 self .xaxis .tick_bottom ()
78017802 self .xaxis .set_ticks_position ('both' )
78027803 self .xaxis .set_major_locator (
0 commit comments