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


Python pyplot.jet函数代码示例

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


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

示例1: baltimore_gmm

def baltimore_gmm(data):
    def fgmm(x):
        return abs(np.sum(gmmimmat[gmmimmat > x]) * .0005 ** 2 - 0.95)

    model = gmm.GMM(3)
    model.train(data, random=False)

    X, Y = makegrid(data)
    gmmimmat = np.zeros(X.shape)

    for i in xrange(X.shape[0]):
        for j in xrange(X.shape[1]):
            gmmimmat[i, j] = model.dgmm(np.array([X[i, j], Y[i, j]]))

    plt.jet()
    plt.imshow(gmmimmat, origin='lower')
    plt.ylim([0, X.shape[0]])
    plt.xlim([0, X.shape[1]])
    plt.savefig('baltimore_gmm.pdf')

    thresh = opt.fmin(fgmm, 10)[0]
    bools = gmmimmat > thresh
    mat = np.zeros(X.shape)
    mat += bools
    plt.imshow(mat, origin='lower')
    plt.ylim([0, X.shape[0]])
    plt.xlim([0, X.shape[1]])
    plt.savefig('gmmavoid.pdf')
开发者ID:davidreber,项目名称:Labs,代码行数:28,代码来源:plots.py

示例2: plotear

def plotear(xi,yi,zi):
    # mask inner circle
    interior1 = sqrt(((xi+1.5)**2) + (yi**2)) < 1.0 
    interior2 = sqrt(((xi-1.5)**2) + (yi**2)) < 1.0
    zi[interior1] = ma.masked
    zi[interior2] = ma.masked
    p.figure(figsize=(16,10))
    pyplot.jet()
    max=2.8
    min=0.4
    steps = 50
    levels=list()
    labels=list()
    for i in range(0,steps):
	levels.append(int((max-min)/steps*100*i)*0.01+min)
    for i in range(0,steps/2):
	labels.append(levels[2*i])
    CSF = p.contourf(xi,yi,zi,levels,norm=colors.LogNorm())
    CS = p.contour(xi,yi,zi,levels, format='%.3f', labelsize='18')
    p.clabel(CS,labels,inline=1,fontsize=9)
    p.title('electrostatic potential of two spherical colloids, R=lambda/3',fontsize=24)
    p.xlabel('z-coordinate (3*lambda)',fontsize=18)
    p.ylabel('radial coordinate r (3*lambda)',fontsize=18)
    # add a vertical bar with the color values
    cbar = p.colorbar(CSF,ticks=labels,format='%.3f')
    cbar.ax.set_ylabel('potential (reduced units)',fontsize=18)
    cbar.add_lines(CS)
    p.show()
开发者ID:ipbs,项目名称:ipbs,代码行数:28,代码来源:show2.py

示例3: plot_percent_traffic

def plot_percent_traffic(category, num_bins, city):
    '''
    plots percent traffic (review_counts) of category in bin
    '''
    a, b =bin_by_review_count(category, num_bins, city)
    c = []
    max_ratio = 0
    for i in xrange(len(a)):
        c.append([])
        for j in xrange(len(a[i])):
            try: 
                ratio = a[i][j]/float(b[i][j])
                c[i].append(ratio)
                if ratio > max_ratio: 
                    max_ratio = ratio
#                     print i,j,max_ratio
            except ZeroDivisionError:
                c[i].append('NA')
#     print c
    
    for i in xrange(len(c)):
        for j in xrange(len(c[i])):
            if c[i][j] == 'NA':
                c[i][j] = 0
                
    plt.imshow(c, interpolation='none', alpha = 1)

    max_lat, min_lat, max_lon, min_lon = city_edges(city)
    plt.xticks([0,len(c[0])-1],[min_lon, max_lon])
    plt.yticks([0,len(c)-1],[min_lat, max_lat])

    plt.jet()
    cb = plt.colorbar() #make color bar
    cb.set_ticks([0,max_ratio])   #two ticks
    cb.set_ticklabels(['low traffic','lots of traffic'])  # put text labels on them
开发者ID:drsaltiel,项目名称:GA_final,代码行数:35,代码来源:plotting_functions.py

示例4: draw

def draw(ax, mu, Sigma):
    # 描画のクリア
    ax.collections = []

    # 等高線を描画
    xlist = np.linspace(-5, 5, 50)
    ylist = np.linspace(-5, 5, 50)
    x,y = np.meshgrid(xlist,ylist)
    z = np.zeros((50,50))
    for i in range(len(ylist)):
        for j in range(len(xlist)):
            xx = np.array([[xlist[j]], [ylist[i]]])
            z[i,j] = gaussian(xx, mu, Sigma)
    cs = ax.pcolor(x, y, z)
    plt.colorbar(cs)
    plt.jet()
    #plt.bone()

    ax.contour(x, y, z, np.linspace(0.0001,0.5,25), colors='k', linewidth=1)

    # ガウス分布の平均を描画
    ax.scatter(mu[0], mu[1], c='b', marker='x')

    # 軸の調整
    ax.set_xlim(-5,5)
    ax.set_ylim(-5,5)
    ax.set_xlabel('x')
    ax.set_ylabel('y')
    ax.set_title('2D Normal distribution')
    ax.grid()

    plt.draw()
开发者ID:knoda,项目名称:StatML,代码行数:32,代码来源:ex_gaussian_2d.py

示例5: plot_bins

def plot_bins(category,num_bins, city):
    '''
    takes a category and city and plots the bins for it
    '''
    a, b = make_bins(category, num_bins, city)
    c = []
    max_ratio = 0
    for i in xrange(len(a)):
        c.append([])
        for j in xrange(len(a[i])):
            try: 
                ratio = a[i][j]/float(b[i][j])
                c[i].append(ratio)
                if ratio > max_ratio: 
                    max_ratio = ratio
#                     print i,j,max_ratio
            except ZeroDivisionError:
                c[i].append('NA')
#     print c
    
    for i in xrange(len(c)):
        for j in xrange(len(c[i])):
            if c[i][j] == 'NA':
                c[i][j] = max_ratio
                
    plt.imshow(c, interpolation='none', alpha = 1)

    max_lat, min_lat, max_lon, min_lon = city_edges(city)
    plt.xticks([0,len(c[0])-1],[min_lon, max_lon])
    plt.yticks([0,len(c)-1],[min_lat, max_lat])

    plt.jet()
    cb = plt.colorbar() #make color bar
    cb.set_ticks([max_ratio, 0])   #two ticks
    cb.set_ticklabels(['high concentration', 'low concentration'])  # put text labels on them
开发者ID:drsaltiel,项目名称:GA_final,代码行数:35,代码来源:plotting_functions.py

示例6: plot_saccade_stats

def plot_saccade_stats(sac,bins=36, fig=None):
    """
    Draws individual saccades (polar coordinatess), directional histogram,
    individual saccades (cartesian coordinates), and a histogram of saccade
    peak velocities
    """
    if fig is None:
        fig = plt.figure()
    dx = sac.xf - sac.xi
    dy = sac.yf - sac.yi
    radii = sac.amplitude
    thetas = np.arctan2(dy, dx)
    theta_bins = np.linspace(-np.pi,np.pi,bins+1)
    theta_hist = np.histogram(thetas,bins=theta_bins)

    plt.jet()
    plt.title("individual saccades")
    # XXX: there's an interesting artifact if we use sac.amplitude as the
    # sac_length in the scatter plot below
    sac_length = np.sqrt((dx**2+dy**2))
    plt.subplot(221,polar=True)
    plt.scatter(thetas,sac_length,alpha=.5,c=sac.amplitude,s=sac.vpeak/10.0)
    plt.colorbar()
    plt.subplot(222,polar=True)
    plt.title("Directional histogram")
    bars = plt.bar(theta_bins[:-1],theta_hist[0],width=(2*np.pi)/bins, alpha=.5)
    plt.subplot(223)
    plt.scatter(dx,dy,alpha=.5,c=sac.amplitude,s=sac.vpeak/10.0)

    #plt.hist(sac_length,bins=100)
    #plt.xlabel("saccade lengths (pixels)")
    plt.subplot(224)
    plt.hist(sac.vpeak,bins=100)
    plt.xlabel("saccade peak velocities")
开发者ID:ivanov,项目名称:pyarbus,代码行数:34,代码来源:viz.py

示例7: test_pca_white

def test_pca_white(sh=(12, 12), m=500, eps=0.1, rc=(10, 10), out_dir="img"):
    # Visualize examples in r x c grid of pca whitened images.
    # Also show that the covariance matrix of whitening data
    # is a diagonal matrix with descending values
    x = test_pca_input(sh, m)
    pca = PCA(x)

    x_white, mean = pca.whiten_pca(x, eps=eps)

    rows, cols = rc

    f, axes = plt.subplots(rows, cols, sharex='col', sharey='row')

    plt.subplots_adjust(hspace=0.1, wspace=0)
    plt.jet()

    for r in range(rows):
        for c in range(cols):
            axes[r][c].imshow(x_white[:, r*cols + c].reshape(sh))
            axes[r][c].axis('off')

    path = os.path.join(out_dir, "pca_filters_{}_{}_{}.png".format(sh, m, eps))
    print("saving {}...".format(path))
    plt.savefig(path, bbox_inches='tight')

    cv = np.dot(x_white, x_white.T)
    plt.clf()
    plt.imshow(cv)
    plt.show()
开发者ID:dracz,项目名称:vision,代码行数:29,代码来源:transform.py

示例8: image_gen

def image_gen(dataName, initValue, finalValue, increment,imgdpi):
	for i in range(initValue,finalValue,increment):
		if not os.path.exists(dataName+"r_"+str(i)+"_abspsi2.png"):
			real=open(dataName + '_' + str(i)).read().splitlines()
			img=open(dataName + 'i_' + str(i)).read().splitlines()
			a_r = numpy.asanyarray(real,dtype='f8') #64-bit double
			a_i = numpy.asanyarray(img,dtype='f8') #64-bit double
			a = a_r[:] + 1j*a_i[:]
			b = np.reshape(a,(xDim,yDim))
			f = plt.imshow(abs(b)**2)
			plt.jet()
			plt.gca().invert_yaxis()
			plt.savefig(dataName+"r_"+str(i)+"_abspsi2.png",dpi=imgdpi)
			plt.close()
			g = plt.imshow(np.angle(b))
			plt.gca().invert_yaxis()
			plt.savefig(dataName+"r_"+str(i)+"_phi.png",dpi=imgdpi)
			plt.close()
			f = plt.imshow(abs(np.fft.fftshift(np.fft.fft2(b)))**2)
			plt.gca().invert_yaxis()
			plt.jet()
			plt.savefig(dataName+"p_"+str(i)+"_abspsi2.png",dpi=imgdpi)
			plt.close()
			g = plt.imshow(np.angle(np.fft.fftshift(np.fft.fft2(b))))
			plt.gca().invert_yaxis()
			plt.savefig(dataName+"p_"+str(i)+"_phi.png",dpi=imgdpi)
			plt.close()
			print "Saved figure: " + str(i) + ".png"
			plt.close()
		else:
			print "File(s) " + str(i) +".png already exist."
开发者ID:peterwittek,项目名称:GPUE,代码行数:31,代码来源:vis.py

示例9: makeConfMat

def makeConfMat(estClasses, gtClasses, outFilename, numClasses = None, plotLabels = False):
   #If not defined, find number of unique numbers in gtClasses
   if numClasses == None:
      numClasses = len(np.unique(gtClasses))

   #X axis is est, y axis is gt
   #First index is y, second is x
   confMat = np.zeros((numClasses, numClasses))
   numInstances = len(estClasses)
   for (gtIdx, estIdx) in zip(gtClasses.astype(int), estClasses.astype(int)):
      confMat[gtIdx, estIdx]  += 1

   plt.jet()
   plt.matshow(confMat)
   plt.colorbar()
   plt.xlabel("Est class")
   plt.ylabel("True class")
   plt.title("Confusion matrix")
   ax = plt.gca()
   ax.xaxis.set_ticks_position('bottom')

   #Plot labels for each field
   if plotLabels:
      for i in range(numClasses):
         for j in range(numClasses):
            labelStr = generateStatString(confMat, i, j)
            #text receives x, y coord of plot
            ax.text(j, i, labelStr, fontweight='bold',
                  horizontalalignment='center', verticalalignment='center',
                  bbox={'facecolor':'white'}, fontsize=6)

   #plt.show()
   plt.savefig(outFilename)
开发者ID:slundqui,项目名称:mlearning_homework,代码行数:33,代码来源:k-means.py

示例10: baltimore_kde

def baltimore_kde(data):
    def fkde(x):
        return abs(np.sum(kdeimmat[kdeimmat > x]) * .0005 ** 2 - 0.95)

    X, Y = makegrid(data)
    kdeimmat = np.zeros(X.shape)
    kernel = stats.gaussian_kde(data.T)
    for i in xrange(X.shape[0]):
        for j in xrange(X.shape[1]):
            kdeimmat[i, j] = kernel.evaluate(np.array([X[i, j], Y[i, j]]))

    plt.jet()
    plt.imshow(kdeimmat, origin='lower')
    plt.ylim([0, X.shape[0]])
    plt.xlim([0, X.shape[1]])
    plt.savefig('baltimore_kde.pdf')

    thresh = opt.fmin(fkde, 10)[0]
    bools = kdeimmat > thresh
    mat = np.zeros(X.shape)
    mat += bools
    plt.imshow(mat, origin='lower')
    plt.ylim([0, X.shape[0]])
    plt.xlim([0, X.shape[1]])
    plt.savefig('kdeavoid.pdf')
开发者ID:davidreber,项目名称:Labs,代码行数:25,代码来源:plots.py

示例11: struct_fact

def struct_fact(density,name,imgdpi):
	fig, ax = plt.subplots()
	#f = plt.quiver(gx,gy)
	f = plt.imshow((np.abs(np.fft.fftshift(np.fft.fft2(density)))),cmap=plt.get_cmap('prism'))
	cbar = fig.colorbar(f)
	cbar.set_clim(1e6,1e11)
	plt.jet()
	plt.savefig(name + "_struct_log10.png",dpi=imgdpi)
	plt.close()
开发者ID:peterwittek,项目名称:GPUE,代码行数:9,代码来源:vis.py

示例12: heatmap_plot

def heatmap_plot(data, size, ratio, dir_name):
	im = plt.imshow(data, interpolation='none', aspect=ratio) # change the aspect if needed
	plt.xticks(range(size))
	plt.jet()
	plt.colorbar()
	plt.clim(0,BAR_RANGE)
	# plt.show()
	plt.savefig(dir_name + 'comp.png')
	plt.close()
开发者ID:hyperchris,项目名称:Tools,代码行数:9,代码来源:process_sensor_data.py

示例13: scaleAxis

def scaleAxis(data,dataName,label,value,imgdpi):
	fig, ax = plt.subplots()
	ax.xaxis.set_major_locator(ScaledLocator(dx=dx))
	ax.xaxis.set_major_formatter(ScaledLocator(dx=dx))
	f = plt.imshow(abs(data)**2)
	cbar = fig.colorbar(f)
	plt.gca().invert_yaxis()
	plt.jet()
	plt.savefig(dataName+"r_"+str(value)+"_"+label +".png",dpi=imgdpi)
	plt.close()
开发者ID:peterwittek,项目名称:GPUE,代码行数:10,代码来源:vis.py

示例14: run3Dheatmap

def run3Dheatmap(X):
    
    plt.imshow(data, interpolation='none', aspect=3./20)

    plt.xticks(range(3), ['a', 'b', 'c'])

    plt.jet()
    plt.colorbar()

    plt.show() 
开发者ID:GavinMendelGleason,项目名称:joyce,代码行数:10,代码来源:similarity.py

示例15: opPot

def opPot(dataName,imgdpi):
	data = open(dataName).read().splitlines()
	a = numpy.asanyarray(data,dtype='f8')
	b = np.reshape(a,(xDim,yDim))
	fig, ax = plt.subplots()
	f = plt.imshow((b))
	plt.gca().invert_yaxis()
	cbar = fig.colorbar(f)
	plt.jet()
	plt.savefig(dataName + ".png",dpi=imgdpi)
	plt.close()
开发者ID:peterwittek,项目名称:GPUE,代码行数:11,代码来源:vis.py


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