@@ -2285,12 +2285,21 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
22852285 height : float or array-like
22862286 The height(s) of the bars.
22872287
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+
22882291 width : float or array-like, default: 0.8
22892292 The width(s) of the bars.
22902293
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+
22912297 bottom : float or array-like, default: 0
22922298 The y coordinate(s) of the bottom side(s) of the bars.
22932299
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+
22942303 align : {'center', 'edge'}, default: 'center'
22952304 Alignment of the bars to the *x* coordinates:
22962305
@@ -2416,13 +2425,19 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
24162425 x = 0
24172426
24182427 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.
24192431 self ._process_unit_info (
2420- [("x" , x ), ("y" , height )], kwargs , convert = False )
2432+ [("x" , x ), ("y" , y ), ( "y" , height )], kwargs , convert = False )
24212433 if log :
24222434 self .set_yscale ('log' , nonpositive = 'clip' )
24232435 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.
24242439 self ._process_unit_info (
2425- [("x" , width ), ("y" , y )], kwargs , convert = False )
2440+ [("x" , x ), ( "x" , width ), ("y" , y )], kwargs , convert = False )
24262441 if log :
24272442 self .set_xscale ('log' , nonpositive = 'clip' )
24282443
@@ -2582,12 +2597,21 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
25822597 width : float or array-like
25832598 The width(s) of the bars.
25842599
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+
25852603 height : float or array-like, default: 0.8
25862604 The heights of the bars.
25872605
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+
25882609 left : float or array-like, default: 0
25892610 The x coordinates of the left side(s) of the bars.
25902611
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+
25912615 align : {'center', 'edge'}, default: 'center'
25922616 Alignment of the base to the *y* coordinates*:
25932617
0 commit comments