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


Python widgets.SpanSelector方法代码示例

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


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

示例1: configure_canvas

# 需要导入模块: from matplotlib import widgets [as 别名]
# 或者: from matplotlib.widgets import SpanSelector [as 别名]
def configure_canvas(self):
        self.figure = Figure(dpi=100)
        self.canvas = FigureCanvasTkAgg(self.figure, master=self)
        self.axis = self.figure.add_subplot(111)
        self.canvas.draw()
        canvas_widget = self.canvas.get_tk_widget()
        canvas_widget.grid(row=0, column=0, sticky=tk.N + tk.W + tk.E + tk.S)
        self.canvas_cursor = Cursor(self.axis, tk.StringVar(master=self.root))
        self.canvas.mpl_connect('motion_notify_event', self.canvas_cursor.mouse_move)
        self.span = SpanSelector(
            self.axis, self.zoom, 'horizontal', useblit=True,
            rectprops=dict(alpha=0.5, facecolor='red'))
        self.mz_span = None
        self.scan = None
        self.annotations = []
        self.canvas.draw() 
开发者ID:mobiusklein,项目名称:ms_deisotope,代码行数:18,代码来源:view.py

示例2: check_span

# 需要导入模块: from matplotlib import widgets [as 别名]
# 或者: from matplotlib.widgets import SpanSelector [as 别名]
def check_span(*args, **kwargs):
    ax = get_ax()

    def onselect(vmin, vmax):
        ax._got_onselect = True
        assert vmin == 100
        assert vmax == 150

    def onmove(vmin, vmax):
        assert vmin == 100
        assert vmax == 125
        ax._got_on_move = True

    if 'onmove_callback' in kwargs:
        kwargs['onmove_callback'] = onmove

    tool = widgets.SpanSelector(ax, onselect, *args, **kwargs)
    do_event(tool, 'press', xdata=100, ydata=100, button=1)
    do_event(tool, 'onmove', xdata=125, ydata=125, button=1)
    do_event(tool, 'release', xdata=150, ydata=150, button=1)

    assert ax._got_onselect

    if 'onmove_callback' in kwargs:
        assert ax._got_on_move 
开发者ID:holzschu,项目名称:python3_ios,代码行数:27,代码来源:test_widgets.py

示例3: plot

# 需要导入模块: from matplotlib import widgets [as 别名]
# 或者: from matplotlib.widgets import SpanSelector [as 别名]
def plot(self):
        # Prepare the data
        data = self.locs[self.field]
        data = data[np.isfinite(data)]
        bins = lib.calculate_optimal_bins(data, 1000)
        # Prepare the figure
        self.figure.clear()
        self.figure.suptitle(self.field)
        axes = self.figure.add_subplot(111)
        axes.hist(data, bins, rwidth=1, linewidth=0)
        data_range = data.ptp()
        axes.set_xlim(
            [bins[0] - 0.05 * data_range, data.max() + 0.05 * data_range]
        )
        self.span = SpanSelector(
            axes,
            self.on_span_select,
            "horizontal",
            useblit=True,
            rectprops=dict(facecolor="green", alpha=0.2),
        )
        self.canvas.draw() 
开发者ID:jungmannlab,项目名称:picasso,代码行数:24,代码来源:filter.py


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