@@ -2285,12 +2285,21 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2285
2285
height : float or array-like
2286
2286
The height(s) of the bars.
2287
2287
2288
+ Note that if *bottom* has units (e.g. datetime), *height* should be in
2289
+ units that are a difference from the value of *bottom* (e.g. timedelta).
2290
+
2288
2291
width : float or array-like, default: 0.8
2289
2292
The width(s) of the bars.
2290
2293
2294
+ Note that if *x* has units (e.g. datetime), then *width* should be in
2295
+ units that are a difference (e.g. timedelta) around the *x* values.
2296
+
2291
2297
bottom : float or array-like, default: 0
2292
2298
The y coordinate(s) of the bottom side(s) of the bars.
2293
2299
2300
+ Note that if *bottom* has units, then the y-axis will get a Locator and
2301
+ Formatter appropriate for the units (e.g. dates, or categorical).
2302
+
2294
2303
align : {'center', 'edge'}, default: 'center'
2295
2304
Alignment of the bars to the *x* coordinates:
2296
2305
@@ -2416,13 +2425,19 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2416
2425
x = 0
2417
2426
2418
2427
if orientation == 'vertical' :
2428
+ # It is possible for y (bottom) to contain unit information.
2429
+ # However, it is also possible for y=0 for the default and height
2430
+ # to contain unit information. This will prioritize the units of y.
2419
2431
self ._process_unit_info (
2420
- [("x" , x ), ("y" , height )], kwargs , convert = False )
2432
+ [("x" , x ), ("y" , y ), ( "y" , height )], kwargs , convert = False )
2421
2433
if log :
2422
2434
self .set_yscale ('log' , nonpositive = 'clip' )
2423
2435
else : # horizontal
2436
+ # It is possible for x (left) to contain unit information.
2437
+ # However, it is also possible for x=0 for the default and width
2438
+ # to contain unit information. This will prioritize the units of x.
2424
2439
self ._process_unit_info (
2425
- [("x" , width ), ("y" , y )], kwargs , convert = False )
2440
+ [("x" , x ), ( "x" , width ), ("y" , y )], kwargs , convert = False )
2426
2441
if log :
2427
2442
self .set_xscale ('log' , nonpositive = 'clip' )
2428
2443
@@ -2582,12 +2597,21 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
2582
2597
width : float or array-like
2583
2598
The width(s) of the bars.
2584
2599
2600
+ Note that if *left* has units (e.g. datetime), *width* should be in
2601
+ units that are a difference from the value of *left* (e.g. timedelta).
2602
+
2585
2603
height : float or array-like, default: 0.8
2586
2604
The heights of the bars.
2587
2605
2606
+ Note that if *y* has units (e.g. datetime), then *height* should be in
2607
+ units that are a difference (e.g. timedelta) around the *y* values.
2608
+
2588
2609
left : float or array-like, default: 0
2589
2610
The x coordinates of the left side(s) of the bars.
2590
2611
2612
+ Note that if *left* has units, then the x-axis will get a Locator and
2613
+ Formatter appropriate for the units (e.g. dates, or categorical).
2614
+
2591
2615
align : {'center', 'edge'}, default: 'center'
2592
2616
Alignment of the base to the *y* coordinates*:
2593
2617
0 commit comments