本文整理汇总了Python中matplotlib.cbook._topmost_artist方法的典型用法代码示例。如果您正苦于以下问题:Python cbook._topmost_artist方法的具体用法?Python cbook._topmost_artist怎么用?Python cbook._topmost_artist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.cbook
的用法示例。
在下文中一共展示了cbook._topmost_artist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send_message
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import _topmost_artist [as 别名]
def send_message(self, event):
"""Call `matplotlib.backend_managers.ToolManager.message_event`"""
if self.toolmanager.messagelock.locked():
return
message = ' '
if event.inaxes and event.inaxes.get_navigate():
try:
s = event.inaxes.format_coord(event.xdata, event.ydata)
except (ValueError, OverflowError):
pass
else:
artists = [a for a in event.inaxes.mouseover_set
if a.contains(event) and a.get_visible()]
if artists:
a = cbook._topmost_artist(artists)
if a is not event.inaxes.patch:
data = a.get_cursor_data(event)
if data is not None:
s += ' [%s]' % a.format_cursor_data(data)
message = s
self.toolmanager.message_event(message, self)
示例2: send_message
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import _topmost_artist [as 别名]
def send_message(self, event):
"""Call `matplotlib.backend_managers.ToolManager.message_event`"""
if self.toolmanager.messagelock.locked():
return
message = ' '
if event.inaxes and event.inaxes.get_navigate():
try:
s = event.inaxes.format_coord(event.xdata, event.ydata)
except (ValueError, OverflowError):
pass
else:
artists = [a for a in event.inaxes._mouseover_set
if a.contains(event) and a.get_visible()]
if artists:
a = cbook._topmost_artist(artists)
if a is not event.inaxes.patch:
data = a.get_cursor_data(event)
if data is not None:
data_str = a.format_cursor_data(data)
if data_str is not None:
s = s + ' ' + data_str
message = s
self.toolmanager.message_event(message, self)