@@ -2242,13 +2242,10 @@ def _convert_dx(dx, x0, xconv, convert):
22422242 except (TypeError , IndexError , KeyError ):
22432243 x = xconv
22442244
2245- delist = False
2246- if not np .iterable (dx ):
2247- dx = [dx ]
2248- delist = True
2249- dx = [convert (x0 + ddx ) - x for ddx in dx ]
2250- if delist :
2251- dx = dx [0 ]
2245+ if np .iterable (dx ):
2246+ dx = [convert (x0 + ddx ) - x for ddx in dx ]
2247+ else :
2248+ dx = convert (x0 + dx ) - x
22522249 except (ValueError , TypeError , AttributeError ):
22532250 # if the above fails (for any reason) just fallback to what
22542251 # we do by default and convert dx by itself.
@@ -3036,15 +3033,20 @@ def broken_barh(self, xranges, yrange, align="bottom", **kwargs):
30363033 [("x" , xdata ), ("y" , ydata )], kwargs , convert = False )
30373034
30383035 vertices = []
3039- y0 , dy = yrange
3036+ ypos , height = yrange
3037+
3038+ # Unit conversion: handling of the difference quantity height is done through
3039+ # _convert_dx() in the same way as width handling in bar().
3040+ y0 = self .convert_yunits (ypos )
3041+ dy = self ._convert_dx (height , ypos , np .array (y0 ), self .convert_yunits )
30403042
30413043 _api .check_in_list (['bottom' , 'center' , 'top' ], align = align )
30423044 if align == "bottom" :
3043- y0 , y1 = self . convert_yunits (( y0 , y0 + dy ))
3045+ y1 = y0 + dy
30443046 elif align == "center" :
3045- y0 , y1 = self . convert_yunits (( y0 - dy / 2 , y0 + dy / 2 ))
3047+ y0 , y1 = y0 - dy / 2 , y0 + dy / 2
30463048 else :
3047- y0 , y1 = self . convert_yunits (( y0 - dy , y0 ))
3049+ y0 , y1 = y0 - dy , y0
30483050
30493051 for xr in xranges : # convert the absolute values, not the x and dx
30503052 try :
0 commit comments