def GetAxesBoundingBox(self, parent_coordinate=False):
"""
Return figure bounding box in wx coordinate
@param parent_coordinate: True if use parent coordinate (default False)
"""
# Calculate figure bounding box. Y coordinate is inverted in matplotlib
# figure comparing to wx panel
width, height = self.GetSize()
ax, ay, aw, ah = self.figure.gca().get_position().bounds
bbox = wx.Rect(ax * width, height - (ay + ah) * height - 1,
aw * width + 2, ah * height + 1)
# If parent_coordinate, add Viewer position in parent
if parent_coordinate:
xw, yw = self.GetPosition()
bbox.x += xw
bbox.y += yw
return bbox
评论列表
文章目录