Re: [Matplotlib-users] 2 possible bugs with make_axes_area_auto_adjustable
On Mon, Feb 13, 2012 at 12:48 PM, C M cmpyt...@gmail.com wrote: I noticed what is causing one of these issues: 1) When I point-pick on the plot, the plot area still jumps (expands vertically a small amount). It used to do this each time I point-picked, but after upgrading MPL it now just does it the *first* time only. But is it possible it can be fixed so it doesn't jump at all? I see why this happens. When I point pick, a popup window pops up and covers the plot. I think this triggers a redraw. What causes the jump in my case is that the plot's title is set, in y coordinate, to 1.04. That is, the line is this: self.subplot.title.set_y(1.04) This is interacting with the line in make_axes_area_auto_adjustable: if self.title.get_visible(): artists.append(self.title) I have a workaround for this, which is just using a tip from Jae Joon to me* from 3 years ago (!). Instead of setting the title offset as shown above, I set it in this fashion: self.subplot.titleOffsetTrans._t = (0., 20.0/72.) self.subplot.titleOffsetTrans.invalidate() And then this somehow doesn't interact with the make_axes_area_auto_ adjustable function. One problem down. (I hope it is OK that I am answering my own questions, but didn't want to leave them out there and have others bother to work on it). -Che * http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg10259.html -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 2 possible bugs with make_axes_area_auto_adjustable
I noticed what is causing one of these issues: 1) When I point-pick on the plot, the plot area still jumps (expands vertically a small amount). It used to do this each time I point-picked, but after upgrading MPL it now just does it the *first* time only. But is it possible it can be fixed so it doesn't jump at all? I see why this happens. When I point pick, a popup window pops up and covers the plot. I think this triggers a redraw. What causes the jump in my case is that the plot's title is set, in y coordinate, to 1.04. That is, the line is this: self.subplot.title.set_y(1.04) This is interacting with the line in make_axes_area_auto_adjustable: if self.title.get_visible(): artists.append(self.title) Essentially, it is getting the bbox, taking into consideration the plot's title and other artists. But if the title is set to greater than 1.00, when I point pick (and force a redraw?), it has to recalculate the plot's axes areas and it adjusts things, so the user sees the small vertical expansion (jump). The problem goes away if I set the plot's title to 1.00: self.subplot.title.set_y(1.00) *However, this puts the title too close to the top of the plot area for my aesthetic liking.* I'd prefer a little larger margin. There should be a simple fix that allows for the title to be a bit higher off the plot area and yet not cause this jump. It would be in the code at the end of this email, but i don't know enough about bbox to fix it yet...any hints? Thanks, Che def axes_get_tightbbox(self, renderer): return the tight bounding box of the axes. The dimension of the Bbox in canvas coordinate. artists = [] bb = [] artists.append(self) if self.title.get_visible(): artists.append(self.title) if self.xaxis.get_visible(): artists.append(self.xaxis.label) bbx1, bbx2 = axis_get_ticklabel_extents(self.xaxis, renderer, True) bb.extend([bbx1, bbx2]) if self.yaxis.get_visible(): artists.append(self.yaxis.label) bby1, bby2 = axis_get_ticklabel_extents(self.yaxis, renderer, True) bb.extend([bby1, bby2]) bb.extend([c.get_window_extent(renderer) for c in artists if c.get_visible()]) _bbox = mtransforms.Bbox.union([b for b in bb if b.width!=0 or b.height!=0]) return _bbox -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 2 possible bugs with make_axes_area_auto_adjustable
Jae-Joon's code, make_axes_area_auto_adjustable has been a great help to dynamically resizing my plots' axes area--such an improvement. But there are two bugs I've noticed that I wonder if has been identified/fixed yet: 1) When I point-pick on the plot, the plot area still jumps (expands vertically a small amount). It used to do this each time I point-picked, but after upgrading MPL it now just does it the *first* time only. But is it possible it can be fixed so it doesn't jump at all? 2) I just noticed that if a plot is resized so that the window that the plot is embedded in is *narrower than the title on the plot*, the resizing of the axes area gets very messed up (it gets *much8 narrower than is necessary to fit the available area). I'm not sure what the best approach to fixing this is, since it's not ideal to have a title not fit the figure's area, either...is it possible to flow-wrap a plot title? Thanks, Che -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users