I noticed what is causing one of these issues:
- 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