Esempio n. 1
0
def ax_contour(xyf,ax):
    xf, yf = xyf
    x_data = list(make_continuous(xvg2array_nt(xf), dnorm=10)) 
    y_data = list(make_continuous(xvg2array_nt(yf), dnorm=10))
    assert len(x_data) == len(y_data)
    h, xp, yp = np.histogram2d(x_data, y_data, bins=options.bins)
    h = h / float(len(x_data)) * 100.
    left, right, bottom, top = xp[0], xp[-1], yp[0], yp[-1]
    extent = [left,right,bottom,top]
    # im = ax.imshow(h, extent=extent,interpolation='bilinear',origin='lower',cmap=cm.gray_r, vmin=10, vmax=8000)
    levels = [ i/100. for i in range(10,400,40)]
    pid, sid = q_acc.get_id(xyf)
    cs = ax.contour(xp[1:]-(xp[1]-xp[0])/2.,
                    yp[1:]-(yp[1]-yp[0])/2., 
                    # make it align with imshow, shift a little since x, y are
                    # bins, the following line do the same thing
                    h,levels=levels,color=mysys[pid].col,extent=extent,origin='lower',
                    label=mysys[pid].seq+mysys[sid].cdt)
    # cs = ax.contour(x[:-1]+(x[1]-x[0])/2.,y[:-1]+(y[1]-y[0])/2,h)

    plt.clabel(cs, [levels[0],levels[1],levels[-1]],  # label every second level
               inline=1,
               fmt='%.2f',
               fontsize=8)
    ax.legend()
    # CBI = plt.colorbar(im, orientation='vertical', shrink=1)
    # zc = len(cs.collections)                                   # line collection
    # print zc
    # plt.setp(zc, linewpidth=4)

    # ax.set_title(mysys[pid].seq)
    # CB = plt.colorbar(cs, shrink=0.6, extend='both')
    # plt.flag()
    return pid+sid, xp, yp
Esempio n. 2
0
File: q_ave.py Progetto: zyxue/pybin
def ax_ave(xyf, ax):
    xf, yf = xyf
    xp, yp = xvg2array(xf)[1], xvg2array(yf)[1]
    (ave_xp, std_xp, ave_yp, std_yp) = (
        np.average(xp), np.std(xp), np.average(yp), np.std(yp))
    tid = q_acc.get_id(xyf)
    sid = tid[:3]
    cid = tid[3]
    ax.errorbar(ave_xp, ave_yp, xerr=std_xp, yerr=std_yp,
                c=mysys[cid].col, marker=mysys[sid].char,
                label=mysys[sid].seq, markersize=10)
    # ax.text(p1[0]*1.01,p2[0]*1.01,p1_file[5:12])
    return tid, ave_xp, std_xp, ave_yp, std_yp