当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python matplotlib DraggableBase用法及代码示例


本文简要介绍 python 语言中 matplotlib.offsetbox.DraggableBase 的用法。

用法

class matplotlib.offsetbox.DraggableBase(ref_artist, use_blit=False)

基础: object

可拖动艺术家的助手基类(图例,偏移框)。

派生类必须覆盖以下方法:

def save_offset(self):
    '''
    Called when the object is picked for dragging; should save the
    reference position of the artist.
    '''

def update_offset(self, dx, dy):
    '''
    Called during the dragging; (*dx*, *dy*) is the pixel offset from
    the point where the mouse drag started.
    '''

或者,您可以覆盖以下方法:

def finalize_offset(self):
    '''Called when the mouse is released.'''

DraggableLegend DraggableAnnotation 的当前实现中,update_offset 将艺术家放置在显示坐标中,finalize_offset 重新计算他们在轴坐标中的位置并设置相关属性。

相关用法


注:本文由纯净天空筛选整理自skytowner.com大神的英文原创作品 matplotlib.offsetbox.DraggableBase。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。