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


Python RectangleSelector.__init__方法代码示例

本文整理汇总了Python中matplotlib.widgets.RectangleSelector.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python RectangleSelector.__init__方法的具体用法?Python RectangleSelector.__init__怎么用?Python RectangleSelector.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.widgets.RectangleSelector的用法示例。


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

示例1: __init__

# 需要导入模块: from matplotlib.widgets import RectangleSelector [as 别名]
# 或者: from matplotlib.widgets.RectangleSelector import __init__ [as 别名]
    def __init__(
        self,
        ax,
        onselect,
        button=None,
        minspanx=None,
        minspany=None,
        useblit=True,
        lineprops=None,
        rectprops=dict(facecolor="red", edgecolor="black", alpha=0.5, fill=True),
        proxy=5,
    ):
        RectangleSelector.__init__(
            self,
            ax=ax,
            onselect=onselect,
            drawtype="box",
            spancoords="data",
            minspanx=minspanx,
            minspany=minspany,
            useblit=useblit,
            lineprops=lineprops,
            rectprops=rectprops,
            button=button,
        )

        self.fixedSize = None
        self.prevEvents = None
        self.proxy = max(
            self.ax.transData.transform_point((proxy / 100, proxy / 100)) - self.ax.transData.transform_point((0, 0))
        )
开发者ID:jochym,项目名称:pointsel,代码行数:33,代码来源:pointsel.py

示例2: __init__

# 需要导入模块: from matplotlib.widgets import RectangleSelector [as 别名]
# 或者: from matplotlib.widgets.RectangleSelector import __init__ [as 别名]
    def __init__(self, ax, on_move=None, on_release=None, on_enter=None, maxdist=10, rect_props=None):
        CanvasToolBase.__init__(self, ax, on_move=on_move, on_enter=on_enter, on_release=on_release)

        props = dict(edgecolor=None, facecolor="r", alpha=0.15)
        props.update(rect_props if rect_props is not None else {})
        if props["edgecolor"] is None:
            props["edgecolor"] = props["facecolor"]
        RectangleSelector.__init__(self, ax, lambda *args: None, rectprops=props, useblit=self.useblit)
        # Alias rectangle attribute, which is initialized in RectangleSelector.
        self._rect = self.to_draw
        self._rect.set_animated(True)

        self.maxdist = maxdist
        self.active_handle = None
        self._extents_on_press = None

        if on_enter is None:

            def on_enter(extents):
                print("(xmin=%.3g, xmax=%.3g, ymin=%.3g, ymax=%.3g)" % extents)

        self.callback_on_enter = on_enter

        props = dict(mec=props["edgecolor"])
        self._corner_order = ["NW", "NE", "SE", "SW"]
        xc, yc = self.corners
        self._corner_handles = ToolHandles(ax, xc, yc, marker_props=props)

        self._edge_order = ["W", "N", "E", "S"]
        xe, ye = self.edge_centers
        self._edge_handles = ToolHandles(ax, xe, ye, marker="s", marker_props=props)

        self._artists = [self._rect, self._corner_handles.artist, self._edge_handles.artist]
开发者ID:alfonsodiecko,项目名称:PYTHON_DIST,代码行数:35,代码来源:recttool.py

示例3: __init__

# 需要导入模块: from matplotlib.widgets import RectangleSelector [as 别名]
# 或者: from matplotlib.widgets.RectangleSelector import __init__ [as 别名]
 def __init__(self, lines, drawtype='box',
              minspanx=None, minspany=None, useblit=False,
              lineprops=None, rectprops=None, spancoords='data',
              button=None, maxdist=10, marker_props=None,
              interactive=False, state_modifier_keys=None):
     
     self.verbose = True
     self.lines = flatten(lines)
     ax = self.lines[0].axes
     
     RectangleSelector.__init__( self, ax, self.select_lines, drawtype,
                                     minspanx, minspany, useblit,
                                     lineprops, rectprops, spancoords,
                                     button, maxdist, marker_props,
                                     interactive, state_modifier_keys)
 
     hprops = dict(linewidth=10, alpha=0.5, linestyle='-') # marker='s'
     self.selection = [ np.zeros(l.get_xdata().shape, bool) 
                         for l in self.lines ]
     
     #Create Line2D for highlighting selected sections
     self.highlighted = []
     for line in self.lines:
         hline, = ax.plot([], [], color=line.get_color(), **hprops)
         self.highlighted.append( hline )
         self.artists.append( hline )       #enable blitting for the highlighted segments
开发者ID:apodemus,项目名称:grafico,代码行数:28,代码来源:interactive.py

示例4: __init__

# 需要导入模块: from matplotlib.widgets import RectangleSelector [as 别名]
# 或者: from matplotlib.widgets.RectangleSelector import __init__ [as 别名]
    def __init__(self, viewer, on_move=None, on_release=None, on_enter=None,
                 maxdist=10, rect_props=None):
        self._rect = None
        props = dict(edgecolor=None, facecolor='r', alpha=0.15)
        props.update(rect_props if rect_props is not None else {})
        if props['edgecolor'] is None:
            props['edgecolor'] = props['facecolor']
        RectangleSelector.__init__(self, viewer.ax, lambda *args: None,
                                   rectprops=props)
        CanvasToolBase.__init__(self, viewer, on_move=on_move,
                                on_enter=on_enter, on_release=on_release)

        # Events are handled by the viewer
        try:
            self.disconnect_events()
        except AttributeError:
            # disconnect the events manually (hack for older mpl versions)
            [self.canvas.mpl_disconnect(i) for i in range(10)]

        # Alias rectangle attribute, which is initialized in RectangleSelector.
        self._rect = self.to_draw
        self._rect.set_animated(True)

        self.maxdist = maxdist
        self.active_handle = None
        self._extents_on_press = None

        if on_enter is None:
            def on_enter(extents):
                print("(xmin=%.3g, xmax=%.3g, ymin=%.3g, ymax=%.3g)" % extents)
        self.callback_on_enter = on_enter

        props = dict(mec=props['edgecolor'])
        self._corner_order = ['NW', 'NE', 'SE', 'SW']
        xc, yc = self.corners
        self._corner_handles = ToolHandles(self.ax, xc, yc, marker_props=props)

        self._edge_order = ['W', 'N', 'E', 'S']
        xe, ye = self.edge_centers
        self._edge_handles = ToolHandles(self.ax, xe, ye, marker='s',
                                         marker_props=props)

        self.artists = [self._rect,
                        self._corner_handles.artist,
                        self._edge_handles.artist]
        viewer.add_tool(self)
开发者ID:haohao200609,项目名称:Hybrid,代码行数:48,代码来源:recttool.py

示例5: __init__

# 需要导入模块: from matplotlib.widgets import RectangleSelector [as 别名]
# 或者: from matplotlib.widgets.RectangleSelector import __init__ [as 别名]
 def __init__(self, ax):
     RectangleSelector.__init__(self, ax, self.onselect)
开发者ID:CDonatelli,项目名称:accelmat,代码行数:4,代码来源:test_feature_track.py


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