I need to get the bboxes for time-range bars (matplotlib.patches.Rectangle objects) on a bar plot for a custom autoscaling function.
Right now, I get them like this, where rectObj = a bar and bboxes = a list of bboxes:
bboxes.append(rectObj.get_path().get_extents())
print 'bboxes is: ', bboxes
However, the print shows bboxes to be:
bboxes is: [Bbox(array([[ 0., 0.],
[ 1., 1.]])), Bbox(array([[ 0., 0.],
[ 1., 1.]])), Bbox(array([[ 0., 0.],
[ 1., 1.]])), Bbox(array([[ 0., 0.],
[ 1., 1.]])), Bbox(array([[ 0., 0.],
[ 1., 1.]])), Bbox(array([[ 0., 0.],
[ 1., 1.]])), Bbox(array([[ 0., 0.],
[ 1., 1.]])), Bbox(array([[ 0., 0.],
[ 1., 1.]])), Bbox(array([[ 0., 0.],
[ 1., 1.]])), Bbox(array([[ 0., 0.],
[ 1., 1.]])), Bbox(array([[ 0., 0.],
[ 1., 1.]])), Bbox(array([[ 0., 0.],
[ 1., 1.]]))]
This is not what I need, because these points have nothing to do with the y axis I’m scaling (in fact, what do they mean?). Instead, I need bboxes that look more like this:
bboxes is: [Bbox(array([[ 734190.02541214, 730844.29166667],
[ 734223.88252666, 730844.375 ]]))]
(Although this is from getting the bboxes from a line, not a set of bars)
These are in the floating point version of a date, which is what the y axis is scaled in. How can I get the bboxes of these bars in those coordinates?
Thanks,
Che