Skip to content

Commit 56f424f

Browse files
author
James Evans
committed
Added some logic to Axes.bar that will preconvert unitized data before creating
the rectangular Patch since not all unitized data can be subtracted with a floating point number (ie. 'left - width') this is especially true with 'time' (time - time = duration). This problem can be seen when passing in a floating-point number for the width, which in-turn should be interpreted to be a number in the units for the axis. This was not being done, and now is. There is probably a better way to handle this. svn path=/trunk/matplotlib/; revision=4811
1 parent b80f0c3 commit 56f424f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/matplotlib/axes.py

+14
Original file line numberDiff line numberDiff line change
@@ -3264,6 +3264,20 @@ def make_iterable(x):
32643264

32653265
patches = []
32663266

3267+
# lets do some conversions now since some types cannot be subtracted uniformly
3268+
if self.xaxis is not None:
3269+
xconv = self.xaxis.converter
3270+
if xconv is not None:
3271+
units = self.xaxis.get_units()
3272+
left = xconv.convert( left, units )
3273+
width = xconv.convert( width, units )
3274+
3275+
if self.yaxis is not None:
3276+
yconv = self.yaxis.converter
3277+
if yconv is not None :
3278+
units = self.yaxis.get_units()
3279+
bottom = yconv.convert( bottom, units )
3280+
height = yconv.convert( height, units )
32673281

32683282
if align == 'edge':
32693283
pass

0 commit comments

Comments
 (0)