Re: [Matplotlib-users] get bboxes of bars in data coordinates
On Mon, Mar 28, 2011 at 1:44 PM, C M wrote: > 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 > OK, I have it... Because I was using the above to get the bbox for a Line2D object, I didn't realize there was already a method to get the bbox (in data coordinates) from a Rectangle: rectObj.get_bbox() -Che -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] get bboxes of bars in data coordinates
I should add, I can see that (I think) this needs to use a transform to get it in data coordinates, because if I do this to each rectObj (each bar): trans = rectObj.get_patch_transform() print 'trans is: ', trans I get: trans is: BboxTransformTo(Bbox(array([[ 734189.52541214, 730844.], [ 734190.52541214, 730844.]]))) Which shows the data-coordinate bboxes "in there", but that's now a BboxTransformTo object, not a Bbox object. I'm just don't know what method turns a display-coordinate bbox into a data-coordinate bbox. Thanks, Che -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] get bboxes of bars in data coordinates
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.2917], [ 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 -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users