PEATDB/Ekin/Plotting.py
def annotate(self):
        """Basic adding of annotation to a plot"""

        axes = self.fig.get_axes()
        def addObject(objtype='text',text='test',x=1,y=1):

            bbox_props = dict(boxstyle="round", fc="#FFFC17", ec="0.4", alpha=0.8)
            if objtype == 'text':
                axes[0].text(x,y, text, ha="center", va="center", size=12, bbox=bbox_props)
            elif objtype == 'arrow':
                axes[0].annotate("",
                        xy=(x,y), xycoords='data',
                        xytext=(x,y), textcoords='data',
                        arrowprops=dict(arrowstyle="->", facecolor='black',
                                        connectionstyle="arc3"),
                        )
            self.canvas.draw()

        main = Toplevel()
        main.geometry('100x200+100+100')
        x=DoubleVar(); y=DoubleVar()
        txt=StringVar()
        objtype=StringVar()

        x=Pmw.EntryField(main,labelpos = 'w',
                label_text = 'x:',
                value = '0')
        x.pack()
        y=Pmw.EntryField(main,labelpos = 'w',
                label_text = 'y:',
                value = '0')
        y.pack()
        txt=Pmw.EntryField(main,labelpos = 'w',
                label_text = 'text:',
                value = '0')
        txt.pack()
        Pmw.OptionMenu(main,labelpos = 'w',
                            label_text = 'type:',
                            menubutton_textvariable = objtype,
                            items = ['text','arrow'],
                            menubutton_width = 8).pack()
        Button(main,text='Add',command=lambda: addObject(objtype=objtype.get(),
                                                    text=txt.getvalue(),
                                                    x=x.getvalue(),y=y.getvalue())).pack()
        return
Basic adding of annotation to a plot
Basic adding of annotation to a plot
Basic adding of annotation to a plot
def annotate(self):
        axes = self.fig.get_axes()
        def addObject(objtype='text',text='test',x=1,y=1):
            bbox_props = dict(boxstyle="round", fc="#FFFC17", ec="0.4", alpha=0.8)
            if objtype == 'text':
                axes[0].text(x,y, text, ha="center", va="center", size=12, bbox=bbox_props)
            elif objtype == 'arrow':
                axes[0].annotate("",
                        xy=(x,y), xycoords='data',
                        xytext=(x,y), textcoords='data',
                        arrowprops=dict(arrowstyle="->", facecolor='black',
                                        connectionstyle="arc3"),
                        )
            self.canvas.draw()
        main = Toplevel()
        main.geometry('100x200+100+100')
        x=DoubleVar(); y=DoubleVar()
        txt=StringVar()
        objtype=StringVar()
        x=Pmw.EntryField(main,labelpos = 'w',
                label_text = 'x:',
                value = '0')
        x.pack()
        y=Pmw.EntryField(main,labelpos = 'w',
                label_text = 'y:',
                value = '0')
        y.pack()
        txt=Pmw.EntryField(main,labelpos = 'w',
                label_text = 'text:',
                value = '0')
        txt.pack()
        Pmw.OptionMenu(main,labelpos = 'w',
                            label_text = 'type:',
                            menubutton_textvariable = objtype,
                            items = ['text','arrow'],
                            menubutton_width = 8).pack()
        Button(main,text='Add',command=lambda: addObject(objtype=objtype.get(),
                                                    text=txt.getvalue(),
                                                    x=x.getvalue(),y=y.getvalue())).pack()
        return
def annotate ( self ) : axes = self . fig . get_axes ( ) def addObject ( objtype = 'text' , text = 'test' , x = 1 , y = 1 ) : bbox_props = dict ( boxstyle = "round" , fc = "#FFFC17" , ec = "0.4" , alpha = 0.8 ) if objtype == 'text' : axes [ 0 ] . text ( x , y , text , ha = "center" , va = "center" , size = 12 , bbox = bbox_props ) elif objtype == 'arrow' : axes [ 0 ] . annotate ( "" , xy = ( x , y ) , xycoords = 'data' , xytext = ( x , y ) , textcoords = 'data' , arrowprops = dict ( arrowstyle = "->" , facecolor = 'black' , connectionstyle = "arc3" ) , ) self . canvas . draw ( ) main = Toplevel ( ) main . geometry ( '100x200+100+100' ) x = DoubleVar ( ) ; y = DoubleVar ( ) txt = StringVar ( ) objtype = StringVar ( ) x = Pmw . EntryField ( main , labelpos = 'w' , label_text = 'x:' , value = '0' ) x . pack ( ) y = Pmw . EntryField ( main , labelpos = 'w' , label_text = 'y:' , value = '0' ) y . pack ( ) txt = Pmw . EntryField ( main , labelpos = 'w' , label_text = 'text:' , value = '0' ) txt . pack ( ) Pmw . OptionMenu ( main , labelpos = 'w' , label_text = 'type:' , menubutton_textvariable = objtype , items = [ 'text' , 'arrow' ] , menubutton_width = 8 ) . pack ( ) Button ( main , text = 'Add' , command = lambda : addObject ( objtype = objtype . get ( ) , text = txt . getvalue ( ) , x = x . getvalue ( ) , y = y . getvalue ( ) ) ) . pack ( ) return
Basic adding of annotation to a plot
Basic adding of annotation to a plot
"""Basic adding of annotation to a plot"""
self