@@ -2336,7 +2336,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2336
2336
if orientation == 'vertical' :
2337
2337
if y is None :
2338
2338
y = 0
2339
- elif orientation == ' horizontal' :
2339
+ else : # horizontal
2340
2340
if x is None :
2341
2341
x = 0
2342
2342
@@ -2345,7 +2345,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2345
2345
[("x" , x ), ("y" , height )], kwargs , convert = False )
2346
2346
if log :
2347
2347
self .set_yscale ('log' , nonpositive = 'clip' )
2348
- elif orientation == ' horizontal' :
2348
+ else : # horizontal
2349
2349
self ._process_unit_info (
2350
2350
[("x" , width ), ("y" , y )], kwargs , convert = False )
2351
2351
if log :
@@ -2374,7 +2374,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2374
2374
if orientation == 'vertical' :
2375
2375
tick_label_axis = self .xaxis
2376
2376
tick_label_position = x
2377
- elif orientation == ' horizontal' :
2377
+ else : # horizontal
2378
2378
tick_label_axis = self .yaxis
2379
2379
tick_label_position = y
2380
2380
@@ -2403,15 +2403,15 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2403
2403
f'and width ({ width .dtype } ) '
2404
2404
f'are incompatible' ) from e
2405
2405
bottom = y
2406
- elif orientation == ' horizontal' :
2406
+ else : # horizontal
2407
2407
try :
2408
2408
bottom = y - height / 2
2409
2409
except TypeError as e :
2410
2410
raise TypeError (f'the dtypes of parameters y ({ y .dtype } ) '
2411
2411
f'and height ({ height .dtype } ) '
2412
2412
f'are incompatible' ) from e
2413
2413
left = x
2414
- elif align == ' edge' :
2414
+ else : # edge
2415
2415
left = x
2416
2416
bottom = y
2417
2417
@@ -2431,7 +2431,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2431
2431
r .get_path ()._interpolation_steps = 100
2432
2432
if orientation == 'vertical' :
2433
2433
r .sticky_edges .y .append (b )
2434
- elif orientation == ' horizontal' :
2434
+ else : # horizontal
2435
2435
r .sticky_edges .x .append (l )
2436
2436
self .add_patch (r )
2437
2437
patches .append (r )
@@ -2442,7 +2442,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2442
2442
ex = [l + 0.5 * w for l , w in zip (left , width )]
2443
2443
ey = [b + h for b , h in zip (bottom , height )]
2444
2444
2445
- elif orientation == ' horizontal' :
2445
+ else : # horizontal
2446
2446
# using list comps rather than arrays to preserve unit info
2447
2447
ex = [l + w for l , w in zip (left , width )]
2448
2448
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",
2459
2459
2460
2460
if orientation == 'vertical' :
2461
2461
datavalues = height
2462
- elif orientation == ' horizontal' :
2462
+ else : # horizontal
2463
2463
datavalues = width
2464
2464
2465
2465
bar_container = BarContainer (patches , errorbar , datavalues = datavalues ,
@@ -2670,46 +2670,47 @@ def sign(x):
2670
2670
if orientation == "vertical" :
2671
2671
extrema = max (y0 , y1 ) if dat >= 0 else min (y0 , y1 )
2672
2672
length = abs (y0 - y1 )
2673
- elif orientation == " horizontal" :
2673
+ else : # horizontal
2674
2674
extrema = max (x0 , x1 ) if dat >= 0 else min (x0 , x1 )
2675
2675
length = abs (x0 - x1 )
2676
2676
2677
2677
if err is None or np .size (err ) == 0 :
2678
2678
endpt = extrema
2679
2679
elif orientation == "vertical" :
2680
2680
endpt = err [:, 1 ].max () if dat >= 0 else err [:, 1 ].min ()
2681
- elif orientation == " horizontal" :
2681
+ else : # horizontal
2682
2682
endpt = err [:, 0 ].max () if dat >= 0 else err [:, 0 ].min ()
2683
2683
2684
2684
if label_type == "center" :
2685
2685
value = sign (dat ) * length
2686
- elif label_type == " edge" :
2686
+ else : # edge
2687
2687
value = extrema
2688
2688
2689
2689
if label_type == "center" :
2690
2690
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
2695
2696
2696
2697
if orientation == "vertical" :
2697
2698
y_direction = - 1 if y_inverted else 1
2698
2699
xytext = 0 , y_direction * sign (dat ) * padding
2699
- else :
2700
+ else : # horizontal
2700
2701
x_direction = - 1 if x_inverted else 1
2701
2702
xytext = x_direction * sign (dat ) * padding , 0
2702
2703
2703
2704
if label_type == "center" :
2704
2705
ha , va = "center" , "center"
2705
- elif label_type == " edge" :
2706
+ else : # edge
2706
2707
if orientation == "vertical" :
2707
2708
ha = 'center'
2708
2709
if y_inverted :
2709
2710
va = 'top' if dat > 0 else 'bottom' # also handles NaN
2710
2711
else :
2711
2712
va = 'top' if dat < 0 else 'bottom' # also handles NaN
2712
- elif orientation == " horizontal" :
2713
+ else : # horizontal
2713
2714
if x_inverted :
2714
2715
ha = 'right' if dat > 0 else 'left' # also handles NaN
2715
2716
else :
@@ -2911,7 +2912,7 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
2911
2912
2912
2913
if orientation == 'vertical' :
2913
2914
locs , heads = self ._process_unit_info ([("x" , locs ), ("y" , heads )])
2914
- else :
2915
+ else : # horizontal
2915
2916
heads , locs = self ._process_unit_info ([("x" , heads ), ("y" , locs )])
2916
2917
2917
2918
# defaults for formats
@@ -7796,7 +7797,7 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
7796
7797
self .title .set_y (1.05 )
7797
7798
if origin == "upper" :
7798
7799
self .xaxis .tick_top ()
7799
- else :
7800
+ else : # lower
7800
7801
self .xaxis .tick_bottom ()
7801
7802
self .xaxis .set_ticks_position ('both' )
7802
7803
self .xaxis .set_major_locator (
0 commit comments