本文整理汇总了Python中transforms.TransformedBbox.contains方法的典型用法代码示例。如果您正苦于以下问题:Python TransformedBbox.contains方法的具体用法?Python TransformedBbox.contains怎么用?Python TransformedBbox.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类transforms.TransformedBbox
的用法示例。
在下文中一共展示了TransformedBbox.contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Figure
# 需要导入模块: from transforms import TransformedBbox [as 别名]
# 或者: from transforms.TransformedBbox import contains [as 别名]
#.........这里部分代码省略.........
"""
allsubplots = np.alltrue([hasattr(ax, "is_last_row") for ax in self.axes])
if len(self.axes) == 1:
for label in ax.get_xticklabels():
label.set_ha(ha)
label.set_rotation(rotation)
else:
if allsubplots:
for ax in self.get_axes():
if ax.is_last_row():
for label in ax.get_xticklabels():
label.set_ha(ha)
label.set_rotation(rotation)
else:
for label in ax.get_xticklabels():
label.set_visible(False)
ax.set_xlabel("")
if allsubplots:
self.subplots_adjust(bottom=bottom)
def get_children(self):
"get a list of artists contained in the figure"
children = [self.patch]
children.extend(self.artists)
children.extend(self.axes)
children.extend(self.lines)
children.extend(self.patches)
children.extend(self.texts)
children.extend(self.images)
children.extend(self.legends)
return children
def contains(self, mouseevent):
"""
Test whether the mouse event occurred on the figure.
Returns True,{}
"""
if callable(self._contains):
return self._contains(self, mouseevent)
# inside = mouseevent.x >= 0 and mouseevent.y >= 0
inside = self.bbox.contains(mouseevent.x, mouseevent.y)
return inside, {}
def get_window_extent(self, *args, **kwargs):
"get the figure bounding box in display space; kwargs are void"
return self.bbox
def suptitle(self, t, **kwargs):
"""
Add a centered title to the figure.
kwargs are :class:`matplotlib.text.Text` properties. Using figure
coordinates, the defaults are:
- *x* = 0.5
the x location of text in figure coords
- *y* = 0.98
the y location of the text in figure coords
- *horizontalalignment* = 'center'
the horizontal alignment of the text