当前位置: 首页>>代码示例>>Python>>正文


Python transforms.blend_xy_sep_transform函数代码示例

本文整理汇总了Python中transforms.blend_xy_sep_transform函数的典型用法代码示例。如果您正苦于以下问题:Python blend_xy_sep_transform函数的具体用法?Python blend_xy_sep_transform怎么用?Python blend_xy_sep_transform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了blend_xy_sep_transform函数的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, ax, onselect, direction, minspan=None, useblit=False, rectprops=None, onmove_callback=None):
        """
        Create a span selector in ax.  When a selection is made, clear
        the span and call onselect with

          onselect(vmin, vmax)

        and clear the span.

        direction must be 'horizontal' or 'vertical'

        If minspan is not None, ignore events smaller than minspan

        The span rect is drawn with rectprops; default
          rectprops = dict(facecolor='red', alpha=0.5)

        set the visible attribute to False if you want to turn off
        the functionality of the span selector


        """
        if rectprops is None:
            rectprops = dict(facecolor='red', alpha=0.5)

        assert direction in ['horizontal', 'vertical'], 'Must choose horizontal or vertical for direction'
        self.direction = direction

        self.ax = ax
        self.visible = True
        self.canvas = ax.figure.canvas
        self.canvas.mpl_connect('motion_notify_event', self.onmove)
        self.canvas.mpl_connect('button_press_event', self.press)
        self.canvas.mpl_connect('button_release_event', self.release)
        self.canvas.mpl_connect('draw_event', self.update_background)

        self.rect = None
        self.background = None

        self.rectprops = rectprops
        self.onselect = onselect
        self.onmove_callback = onmove_callback
        self.useblit = useblit
        self.minspan = minspan

        # Needed when dragging out of axes
        self.buttonDown = False
        self.prev = (0, 0)

        if self.direction == 'horizontal':
            trans = blend_xy_sep_transform(self.ax.transData, self.ax.transAxes)
            w,h = 0,1
        else:
            trans = blend_xy_sep_transform(self.ax.transAxes, self.ax.transData)
            w,h = 1,0
        self.rect = Rectangle( (0,0), w, h,
                               transform=trans,
                               visible=False,
                               **self.rectprops
                               )

        if not self.useblit: self.ax.add_patch(self.rect)
        self.pressv = None
开发者ID:gkliska,项目名称:razvoj,代码行数:62,代码来源:widgets.py


注:本文中的transforms.blend_xy_sep_transform函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。