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


Python pyplot.connect方法代码示例

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


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

示例1: hzfunc

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import connect [as 别名]
def hzfunc(self,label):
        ax = self.hzdict[label]
        num = int(label.replace("plot ",""))
        #print "Selected axis number:", num
        #global mainnum
        self.mainnum = num
        # drawtype is 'box' or 'line' or 'none'
        toggle_selector.RS = RectangleSelector(ax, self.line_select_callback,
                                           drawtype='box', useblit=True,
                                           button=[1,3], # don't use middle button
                                           minspanx=5, minspany=5,
                                           spancoords='pixels',
                                           rectprops = dict(facecolor='red', edgecolor = 'black', alpha=0.2, fill=True))

        #plt.connect('key_press_event', toggle_selector)
        plt.draw() 
开发者ID:geomagpy,项目名称:magpy,代码行数:18,代码来源:mpplot.py

示例2: __init__

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import connect [as 别名]
def __init__(self, filename):
        self.filename = filename
        self.image_data = cv2.imread(filename, 0)
        fig_image, current_ax = plt.subplots()
        plt.imshow(self.image_data, cmap='gray')
        eh = EventHandler(self.filename)
        rectangle_selector = RectangleSelector(current_ax,
                                               eh.line_select_callback,
                                               drawtype='box',
                                               useblit=True,
                                               button=[1, 2, 3],
                                               minspanx=5, minspany=5,
                                               spancoords='pixels',
                                               interactive=True)
        plt.connect('key_press_event', eh.event_exit_manager)
        plt.show() 
开发者ID:bvnayak,项目名称:PDS_Compute_MTF,代码行数:18,代码来源:PDS_Compute_MTF.py

示例3: markpoints

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import connect [as 别名]
def markpoints(self, dataarray,keyarray):
        for idx,elem in enumerate(dataarray):
            key = keyarray[idx]
            #print "Selected curve - markpoints:", idx
            #print dataarray[idx]
            if not idx == 0 and not len(elem) == 0 and key in self.keylist: #FLAGKEYLIST:
                #print ( idx, self.axlist[idx-1] )
                ax = self.axlist[idx-1]
                #ax.clear()
                #ax.text(dataarray[0][1],dataarray[1][1], "(%s, %3.2f)"%("Hello",3.67), )
                ax.scatter(dataarray[0].astype('<f8'),elem.astype('<f8'), c='r', zorder=100) #, marker='d', c='r') #, zorder=100)

        #plt.connect('key_press_event', toggle_selector)
        plt.draw() 
开发者ID:geomagpy,项目名称:magpy,代码行数:16,代码来源:mpplot.py

示例4: show

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import connect [as 别名]
def show(self):
        # Read and draw image
        dpi = 80
        w = 16
        h = 9
        self.fig = plt.figure(figsize=(w, h), dpi=dpi)
        self.ax = self.fig.add_axes([0.0, 0.0, 1.0, 1.0], frameon=False)
        if len(self.image_paths) > 1:
            plt.connect('key_release_event', self.next_image)
        self.show_image()
        plt.show() 
开发者ID:ucbdrive,项目名称:bdd100k,代码行数:13,代码来源:show_labels.py

示例5: __init__

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import connect [as 别名]
def __init__(self, im, materials):
        """
        Args:
            im (ndarray): Pixels of the image.
            materials (list): To store selected RGB(A) values of selected pixels.
        """
        self.im = im
        self.materials = materials
        plt.connect('button_press_event', self) 
开发者ID:gprMax,项目名称:gprMax,代码行数:11,代码来源:convert_png2h5.py

示例6: startup

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import connect [as 别名]
def startup(self, fig, data):
        print("--------------------------------------------")
        print(" you started the build-in flagging function")
        print("--------------------------------------------")
        print("    -- use mouse to select rectangular areas")
        print("    -- press f for flagging this region")
        print("    --      press 2,3 to change default flag ID")
        print("    -- press l to get some basic data info")
        print("    -- press o to apply an offset")
        print("    -- press h to get all meta information")
        print("    -- press c to close the window and allow saving")

        # Arrays to exchange data
        self.selarray = []
        # Globals
        self.idxar = [] # holds all selected index values
        #mainnum = 1 # holds the selected figure axis

        self.axlist = fig.axes

        # #############################################################
        ## Adding Radiobttons to switch selector between different plot
        # #############################################################

        plt.subplots_adjust(left=0.2)
        axcolor = 'lightgoldenrodyellow'
        rax = plt.axes([0.02, 0.8, 0.10, 0.15])
        rax.patch.set_facecolor(axcolor)

        # create dict and list
        numlst = ['plot '+str(idx+1) for idx,elem in enumerate(self.axlist)]
        ## python 2.7 and higher
        #  self.hzdict = {'plot '+str(idx+1):elem for idx,elem in enumerate(self.axlist)}
        ## python 2.6 and lower
        self.hzdict = dict(('plot '+str(idx+1),elem) for idx,elem in enumerate(self.axlist))
        radio = RadioButtons(rax, numlst)

        # #############################################################
        ## Getting a rectangular selector
        # #############################################################

        toggle_selector.RS = RectangleSelector(self.axlist[0], self.line_select_callback, drawtype='box', useblit=True,button=[1,3],minspanx=5, minspany=5,spancoords='pixels', rectprops = dict(facecolor='red', edgecolor = 'black', alpha=0.2, fill=True))

        plt.connect('key_press_event', self.toggle_selector)

        return radio, self.hzfunc 
开发者ID:geomagpy,项目名称:magpy,代码行数:48,代码来源:mpplot.py


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