PEATDB/Ekin/Titration.py
def doXYPlot(cls, ax, x, y, names=None, err=0.5,
                    title=None, xerrs=None, yerrs=None,
                    xlabel=None, ylabel=None,
                    xaxislabels=None, color=None, symbol=None, markersize=30):
        """Do xy plot of 2 lists and show correlation
           annotate is a list of tuples with x,y coord and text to print at that pt"""

        if len(x) == 0:
            return None
        if color == None:
            clr = 'b'
        else:
            clr = color
        if symbol == None:
            symb = 'o'
        else:
            symb = symbol

        if min(x)<min(y): a=min(x)-1
        else: a=min(y)-1
        if max(x)>max(y): b=max(x)+1
        else: b=max(y)+1

        ax.plot((a,b),(a,b),color='black')
        ax.scatter(x, y, facecolor=clr, marker=symb, s=markersize,
                            picker=4, alpha=0.6)

        if names!=None:
            c=0
            for i in zip(x,y):
                if abs(i[0]-i[1])>err:
                    #z = pylab.Circle((i[0], i[1]), 0.2,fill=False,alpha=0.7)
                    #ax.add_patch(z)
                    ax.annotate(names[c], (i[0]+0.1, i[1]),
                                xytext=None, textcoords='data',
                                fontsize=10)
                c+=1

        pylab.rc('font',size=18)
        ax.set_title(title)
        ax.set_xlabel(xlabel)
        ax.set_ylabel(ylabel)
        if xaxislabels != None:
            ax.set_xticklabels(xaxislabels, rotation='vertical', fontproperties=ft)
        if xerrs!=None or yerrs!=None:
            errline = ax.errorbar(x, y, xerr=xerrs, yerr=yerrs, fmt=None,
                                        elinewidth=.5, ecolor=clr, alpha=0.7)
        ax.set_xlim(a,b); ax.set_ylim(a,b)
        cc = round(numpy.corrcoef(numpy.array([x,y]))[0][1],2)
        rmse = round(cls.rmse(x,y),2)
        #print 'corr. coeff:', cc
        #print 'RMSE:', rmse
        return cc, rmse
Do xy plot of 2 lists and show correlation
           annotate is a list of tuples with x,y coord and text to print at that pt
Do xy plot of 2 lists and show correlation
annotate is a list of tuples with x,y coord and text to print at that pt
Do xy plot of 2 lists and show correlation annotate is a list of tuples with x y coord and text to print at that pt
def doXYPlot(cls, ax, x, y, names=None, err=0.5,
                    title=None, xerrs=None, yerrs=None,
                    xlabel=None, ylabel=None,
                    xaxislabels=None, color=None, symbol=None, markersize=30):
        if len(x) == 0:
            return None
        if color == None:
            clr = 'b'
        else:
            clr = color
        if symbol == None:
            symb = 'o'
        else:
            symb = symbol
        if min(x)<min(y): a=min(x)-1
        else: a=min(y)-1
        if max(x)>max(y): b=max(x)+1
        else: b=max(y)+1
        ax.plot((a,b),(a,b),color='black')
        ax.scatter(x, y, facecolor=clr, marker=symb, s=markersize,
                            picker=4, alpha=0.6)
        if names!=None:
            c=0
            for i in zip(x,y):
                if abs(i[0]-i[1])>err:
                    ax.annotate(names[c], (i[0]+0.1, i[1]),
                                xytext=None, textcoords='data',
                                fontsize=10)
                c+=1
        pylab.rc('font',size=18)
        ax.set_title(title)
        ax.set_xlabel(xlabel)
        ax.set_ylabel(ylabel)
        if xaxislabels != None:
            ax.set_xticklabels(xaxislabels, rotation='vertical', fontproperties=ft)
        if xerrs!=None or yerrs!=None:
            errline = ax.errorbar(x, y, xerr=xerrs, yerr=yerrs, fmt=None,
                                        elinewidth=.5, ecolor=clr, alpha=0.7)
        ax.set_xlim(a,b); ax.set_ylim(a,b)
        cc = round(numpy.corrcoef(numpy.array([x,y]))[0][1],2)
        rmse = round(cls.rmse(x,y),2)
        return cc, rmse
def doXYPlot ( cls , ax , x , y , names = None , err = 0.5 , title = None , xerrs = None , yerrs = None , xlabel = None , ylabel = None , xaxislabels = None , color = None , symbol = None , markersize = 30 ) : if len ( x ) == 0 : return None if color == None : clr = 'b' else : clr = color if symbol == None : symb = 'o' else : symb = symbol if min ( x ) < min ( y ) : a = min ( x ) - 1 else : a = min ( y ) - 1 if max ( x ) > max ( y ) : b = max ( x ) + 1 else : b = max ( y ) + 1 ax . plot ( ( a , b ) , ( a , b ) , color = 'black' ) ax . scatter ( x , y , facecolor = clr , marker = symb , s = markersize , picker = 4 , alpha = 0.6 ) if names != None : c = 0 for i in zip ( x , y ) : if abs ( i [ 0 ] - i [ 1 ] ) > err : ax . annotate ( names [ c ] , ( i [ 0 ] + 0.1 , i [ 1 ] ) , xytext = None , textcoords = 'data' , fontsize = 10 ) c += 1 pylab . rc ( 'font' , size = 18 ) ax . set_title ( title ) ax . set_xlabel ( xlabel ) ax . set_ylabel ( ylabel ) if xaxislabels != None : ax . set_xticklabels ( xaxislabels , rotation = 'vertical' , fontproperties = ft ) if xerrs != None or yerrs != None : errline = ax . errorbar ( x , y , xerr = xerrs , yerr = yerrs , fmt = None , elinewidth = .5 , ecolor = clr , alpha = 0.7 ) ax . set_xlim ( a , b ) ; ax . set_ylim ( a , b ) cc = round ( numpy . corrcoef ( numpy . array ( [ x , y ] ) ) [ 0 ] [ 1 ] , 2 ) rmse = round ( cls . rmse ( x , y ) , 2 ) return cc , rmse
Do xy plot of 2 lists and show correlation
annotate is a list of tuples with x,y coord and text to print at that pt
Do xy plot of 2 lists and show correlation annotate is a list of tuples with x y coord and text to print at that pt
"""Do xy plot of 2 lists and show correlation
           annotate is a list of tuples with x,y coord and text to print at that pt""" #z = pylab.Circle((i[0], i[1]), 0.2,fill=False,alpha=0.7) #ax.add_patch(z) #print 'corr. coeff:', cc #print 'RMSE:', rmse
cls
ax
x
y
names
err
title
xerrs
yerrs
xlabel
ylabel
xaxislabels
color
symbol
markersize