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


Python pylab.xscale函数代码示例

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


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

示例1: nova_plot

def nova_plot():

	erg2mev=624151.

	fig=plot.figure()
	yrange = [1e-6,2e-4]
	xrange = [1e-1,1e5]
	plot.fill_between([0.2,10e3],[yrange[1],yrange[1]],[yrange[0],yrange[0]],facecolor='yellow',interpolate=True,color='yellow',alpha=0.5)
	plot.annotate('AMEGO',xy=(3,9e-5),xycoords='data',fontsize=26,color='black')

	lat=ascii.read("data/NMon2012.LAT.dat",names=['energy','en_low','en_high','flux','flux_err','tmp'])
	plot.scatter(lat['energy'],lat['flux']*erg2mev,color='red')
	plot.errorbar(lat['energy'],lat['flux']*erg2mev,xerr=[lat['en_low'],lat['en_high']],yerr=lat['flux_err']*erg2mev,ecolor='red',capsize=0,fmt='none')
	latul=ascii.read("data/NMon2012.LAT.limits.dat",names=['energy','en_low','en_high','flux','tmp1','tmp2','tmp3','tmp4'])
	plot.errorbar(latul['energy'],latul['flux']*erg2mev,xerr=[latul['en_low'],latul['en_high']],yerr=0.5*latul['flux']*erg2mev,uplims=True,ecolor='red',capsize=0,fmt='none')
	plot.scatter(latul['energy'],latul['flux']*erg2mev,color='red')

	leptonic=ascii.read("data/sp-NMon12-IC-best-fit-1MeV-30GeV.txt",names=['energy','flux'],data_start=1)
	hadronic=ascii.read("data/sp-NMon12-pi0-and-secondaries.txt",names=['energy','flux1','flux2'],data_start=1)	

	plot.plot(leptonic['energy'],leptonic['flux']*erg2mev,'r--',color='black',lw=2,label='Leptonic')
	plot.plot(hadronic['energy'],hadronic['flux2']*erg2mev,color='black',lw=2,label='Hadronic+Secondary Leptons')

	plot.legend(loc='upper right',fontsize='small',frameon=False,framealpha=0.5)
	plot.xscale('log')
	plot.yscale('log')
	plot.ylim(yrange)
	plot.xlim(xrange)
	plot.xlabel(r'Energy (MeV)')
	plot.ylabel(r'Energy$^2 \times $ Flux (Energy) (erg cm$^{-2}$ s$^{-1}$)')
	plot.title('Nova V339 Del 2013')
	plot.savefig('Nova_SED.png', bbox_inches='tight')
	plot.savefig('Nova_SED.eps', bbox_inches='tight')
	plot.show()
	plot.close()
开发者ID:ComPair,项目名称:python,代码行数:35,代码来源:SciencePlots.py

示例2: plot_degreeRate

def plot_degreeRate(db, keynames, save_path):
	degRate_x_name = 'degRateDistr_x'
	degRate_y_name = 'degRateDistr_y'

	plt.clf()
	plt.figure(figsize = (8, 5))

	plt.subplot(1, 2, 1)
	plt.plot(db[keynames['mog']][degRate_x_name], db[keynames['mog']][degRate_y_name], 'b-', lw=5, label = 'fairyland')
	plt.plot(db[keynames['mblg']][degRate_x_name], db[keynames['mblg']][degRate_y_name], 'r:', lw=5, label = 'twitter')
	plt.plot(db[keynames['im']][degRate_x_name], db[keynames['im']][degRate_y_name], 'k--', lw=5, label = 'yahoo')
	plt.xscale('log')
	plt.grid(True)
	plt.title('interaction')
	plt.legend(('fairyland', 'twitter', 'yahoo'), loc = 4, prop = {'size': 10})
	plt.xlabel('In-degree to Out-degree Ratio')
	plt.ylabel('CDF')

	plt.subplot(1, 2, 2)
	plt.plot(db[keynames['mogF']][degRate_x_name], db[keynames['mogF']][degRate_y_name], 'b-', lw=5, label = 'fairyland')
	plt.plot(db[keynames['mblgF']][degRate_x_name], db[keynames['mblgF']][degRate_y_name], 'r:', lw=5, label = 'twitter')
	#plt.plot(db[keynames['imF']][degRate_x_name], db[keynames['imF']][degRate_y_name], 'k--', lw=5, label = 'yahoo')
	plt.xscale('log')
	plt.grid(True)
	plt.title('ally')
	plt.xlabel('In-degree to Out-degree Ratio')
	plt.ylabel('CDF')

	plt.savefig(os.path.join(save_dir, save_path))
开发者ID:kaeaura,项目名称:churn_prediction_proj,代码行数:29,代码来源:paper_ploter.py

示例3: test_power_spectra

def test_power_spectra(r0, N, delta, L0, l0):
    N*= 10
    phase_screen = atmosphere.ft_phase_screen(r0, N, delta, L0, l0)
    phase_screen = phase_screen[:N/10, :N/10]
    power_spec_2d = numpy.fft.fft2(phase_screen, s=(N*2, N*2))

    plt.figure()
    plt.imshow(numpy.abs(numpy.fft.fftshift(power_spec_2d)), interpolation='nearest')

    power_spec = circle.aziAvg(numpy.abs(numpy.fft.fftshift(power_spec_2d)))
    power_spec /= power_spec.sum()

    freqs = numpy.fft.fftfreq(power_spec_2d.shape[0], delta)

    # Theoretical Model of Power Spectrum

    print freqs

    plt.figure()
    plt.plot(freqs[:freqs.size/2], power_spec)
    plt.xscale('log')
    plt.yscale('log')
    plt.show()

    return None
开发者ID:EdwardBetts,项目名称:soapytest,代码行数:25,代码来源:testSpatialPowSpec.py

示例4: plotFeaturePDF

def plotFeaturePDF(ift, pft, outbase, fmin=0.0, fmax=1.0, fstep=0.01):
    """
    Plot a comparison between the input feature distribution and the 
    feature distribution of the predicted halos
    """
    plt.clf()
    nfbins = ( fmax - fmin ) / fstep
    fbins = np.logspace( fmin, fmax, nfbins )
    fcen = ( fbins[:-1] + fbins[1:] ) / 2

    plt.xscale( 'log', nonposx='clip' )
    plt.yscale( 'log', nonposy='clip' )
    
    ic, e, p = plt.hist( ift, fbins, label='Original Halos', alpha=0.5, normed=True )
    pc, e, p = plt.hist( pft, fbins, label='Added Halos', alpha=0.5, normed=True )

    plt.legend()
    plt.xlabel( r'$\delta$' )
    plt.savefig( outbase+'_fpdf.png' )

    fdtype = np.dtype( [ ('fcen', float), ('ifcounts', float), ('pfcounts', float) ] )
    fd = np.ndarray( len(fcen), dtype = fdtype )
    fd[ 'mcen' ] = fcen
    fd[ 'imcounts' ] = ic
    fd[ 'pmcounts' ] = pc

    fitsio.write( outbase+'_fpdf.fit', fd )
开发者ID:j-dr,项目名称:ADDHALOS,代码行数:27,代码来源:validation.py

示例5: wykres

def wykres(katalog):
    import numpy as np
    import os
    import scipy.io.wavfile as siw
    import json
    import scipy.fftpack as sf
    import matplotlib.pylab as plt
    os.chdir(katalog)
    song = open('song.txt', 'r')
    songlist = list()
    defs = json.load(open('defs.txt', 'r'))
    beat = defs["bpm"]
    nframes = 60/beat*44100
    for songline in song:
        track = open('track'+songline.strip('\n')+'.txt', 'r')
        tracklist = list()
        for trackline in track:
            y = np.zeros([nframes, 2])
            for i in range(len(trackline.split())):
                y = y + siw.read('sample'+''.join(trackline.split()[i])+'.wav')[1][0:nframes]
            y = np.mean(y,axis=1)
            y /= 32767
            tracklist = np.r_[tracklist, y]
        songlist = np.r_[songlist, tracklist]
    yf = sf.fft(songlist)
    n = yf.size
    xf = np.linspace(0, 44100/2, n/2)
    plt.plot(xf, 2*(yf[1:int(n/2)+1])/n)
    plt.xscale('log')
    plt.show()
开发者ID:pkpytlak,项目名称:PythonPD3,代码行数:30,代码来源:wykres.py

示例6: plotMassFunction

def plotMassFunction(im, pm, outbase, mmin=9, mmax=13, mstep=0.05):
    """
    Make a comparison plot between the input mass function and the 
    predicted projected correlation function
    """
    plt.clf()

    nmbins = ( mmax - mmin ) / mstep
    mbins = np.logspace( mmin, mmax, nmbins )
    mcen = ( mbins[:-1] + mbins[1:] ) /2
    
    plt.xscale( 'log', nonposx = 'clip' )
    plt.yscale( 'log', nonposy = 'clip' )
    
    ic, e, p = plt.hist( im, mbins, label='Original Halos', alpha=0.5, normed = True)
    pc, e, p = plt.hist( pm, mbins, label='Added Halos', alpha=0.5, normed = True)
    
    plt.legend()
    plt.xlabel( r'$M_{vir}$' )
    plt.ylabel( r'$\frac{dN}{dM}$' )
    #plt.tight_layout()
    plt.savefig( outbase+'_mfcn.png' )
    
    mdtype = np.dtype( [ ('mcen', float), ('imcounts', float), ('pmcounts', float) ] )
    mf = np.ndarray( len(mcen), dtype = mdtype )
    mf[ 'mcen' ] = mcen
    mf[ 'imcounts' ] = ic
    mf[ 'pmcounts' ] = pc

    fitsio.write( outbase+'_mfcn.fit', mf )
开发者ID:j-dr,项目名称:ADDHALOS,代码行数:30,代码来源:validation.py

示例7: test_simple_gen

 def test_simple_gen(self):
     self_con = .8
     other_con = 0.05
     g = self.gen.gen_stoch_blockmodel(min_degree=1, blocks=5, self_con=self_con, other_con=other_con,
                                       powerlaw_exp=2.1, degree_seq='powerlaw', num_nodes=1000, num_links=3000)
     deg_hist = vertex_hist(g, 'total')
     res = fit_powerlaw.Fit(g.degree_property_map('total').a, discrete=True)
     print 'powerlaw alpha:', res.power_law.alpha
     print 'powerlaw xmin:', res.power_law.xmin
     if len(deg_hist[0]) != len(deg_hist[1]):
         deg_hist[1] = deg_hist[1][:len(deg_hist[0])]
     print 'plot degree dist'
     plt.plot(deg_hist[1], deg_hist[0])
     plt.xscale('log')
     plt.xlabel('degree')
     plt.ylabel('#nodes')
     plt.yscale('log')
     plt.savefig('deg_dist_test.png')
     plt.close('all')
     print 'plot graph'
     pos = sfdp_layout(g, groups=g.vp['com'], mu=3)
     graph_draw(g, pos=pos, output='graph.png', output_size=(800, 800),
                vertex_size=prop_to_size(g.degree_property_map('total'), mi=2, ma=30), vertex_color=[0., 0., 0., 1.],
                vertex_fill_color=g.vp['com'],
                bg_color=[1., 1., 1., 1.])
     plt.close('all')
     print 'init:', self_con / (self_con + other_con), other_con / (self_con + other_con)
     print 'real:', gt_tools.get_graph_com_connectivity(g, 'com')
开发者ID:floriangeigl,项目名称:tools,代码行数:28,代码来源:gt_tools_tests.py

示例8: plot_ccdf

def plot_ccdf(values, xscale, yscale):
    pylab.yscale(yscale)
    cdf = Cdf.MakeCdfFromList(values)
    values, prob = cdf.Render()
    pylab.xscale(xscale)
    compProb = [1 - e for e in prob] 
    pylab.plot(values, compProb)
开发者ID:giovannipbonin,项目名称:thinkComplexity,代码行数:7,代码来源:plotCcdf.py

示例9: plot_scatter

def plot_scatter(times):
    pl.scatter(times[:, 0], times[:, 1])
    pl.xlabel('Time in seconds')
    pl.ylabel('Ratio')
    pl.title('Time in seconds versus the ratio')
    pl.xlim(0, 300)
    pl.xscale('log')
    pl.show()
开发者ID:VanHElsing,项目名称:VanHElsing,代码行数:8,代码来源:analyzeNewStrats.py

示例10: plot_times

def plot_times():
    res = []
    with open('times', 'r') as f:
        for l in f.readlines():
            x = eval(l)
            res += [(x['samples'], x['auto'], x['tri'])]

    res = list(zip(*res))
    pl_auto = pl.plot(res[0], res[1])
    pl_tri = pl.plot(res[0], res[2])
    pl.xscale('log')
    pl.ylabel("time (in seconds)")
    pl.xlabel("points (logarithmic scale)")
    pl.legend((pl_auto[0], pl_tri[0]), ('auto', 'tri'))

    pl.show()
开发者ID:hotator,项目名称:python-clustering,代码行数:16,代码来源:main.py

示例11: doPlot

def doPlot(parallel_aucs, serial_aucs, times, errors):
    times = list(times)
    times_histo = np.histogram(parallel_aucs,bins=times)
    #values,edges = times_histo
    parallel_values = parallel_aucs[1:]
    edges = times
    print(len(parallel_values))
    print(len(edges))
    serial_values = np.array(serial_aucs[1:])
    errors = np.array(errors[1:])
    edges = np.array(times[:-1])
    print(errors.shape)
    print(edges.shape)
    print(serial_values.shape)


    plt.figure()
    plt.plot(edges, parallel_values,label = "Distributed search") #, width=np.diff(edges), ec="k", align="edge")
    plt.plot(edges, serial_values, label="Sequential search") #, width=np.diff(edges), ec="k", align="edge")
    #plt.fill_between(edges, serial_values-errors,serial_values+errors)
    plt.legend(loc = (0.6,0.7))
    plt.xlabel("Time [minutes]", fontsize=20)
    #plt.yscale('log')
    plt.ylabel('Best validation AUC', fontsize=20)
    plt.savefig("times.png")

    plt.figure()
    plt.plot(edges, parallel_values,label = "Distributed search") #, width=np.diff(edges), ec="k", align="edge")
    plt.plot(edges, serial_values, label="Sequential search") #, width=np.diff(edges), ec="k", align="edge")
    #plt.fill_between(edges, serial_values-errors,serial_values+errors)
    plt.legend(loc = (0.6,0.7))
    plt.xlabel("Time [minutes]", fontsize=20)
    plt.xscale('log')
    plt.xlim([0,100])
    plt.ylabel('Best validation AUC', fontsize=20)
    plt.savefig("times_logx_start.png")

    plt.figure()
    plt.plot(edges, parallel_values,label = "Distributed search") #, width=np.diff(edges), ec="k", align="edge")
    plt.plot(edges, serial_values, label="Sequential search") #, width=np.diff(edges), ec="k", align="edge")
    #plt.fill_between(edges, serial_values-errors,serial_values+errors)
    plt.legend(loc = (0.6,0.7))
    plt.xlabel("Time [minutes]", fontsize=20)
    plt.xscale('log')
    plt.xlim([100,10000])
    plt.ylabel('Best validation AUC', fontsize=20)
    plt.savefig("times_logx.png")
开发者ID:Sprinterzzj,项目名称:plasma-python,代码行数:47,代码来源:extract_best_overtime.py

示例12: plotPSD

def plotPSD(lcInt, shortExp,**kwargs):
    '''
    plot power spectral density of lc
    return frequencies and powers from periodogram
    '''
    freq = 1.0/shortExp
    f, p = periodogram(lcInt,fs = 1./shortExp)

    plt.plot(f,p/np.max(p),**kwargs)
    plt.xlabel(r"Frequency (Hz)",fontsize=14)
    plt.xscale('log')
    plt.ylabel(r"Normalized PSD",fontsize=14)
    plt.yscale('log')
    plt.title(r"Lightcurve Power Spectrum",fontsize=14)
    plt.show()

    return f,p
开发者ID:srmeeker,项目名称:DarknessPipeline,代码行数:17,代码来源:lightCurves.py

示例13: plot

    def plot(self,bins=1000,der=0,log=False,error=False,color=None):
        if log==True:
            x=np.logspace(log10(self.minX)+1e-7,log10(self.maxX)-1e-7,num=bins)
            plt.xscale("log")
        else:
            x=np.linspace(self.minX,self.maxX,num=bins)

        y=self.__call__(x,der=der)
        plt.plot(x,y,color=color)
        
        if(error==True):
            ymin=self.__call__(x,der=der,value="top")
            ymax=self.__call__(x,der=der,value="bottom")
            
            plt.plot(x,ymax,color=color)
            plt.plot(x,ymin,color=color)
            plt.fill_between(x, ymin,ymax,alpha=0.5,color=color)
开发者ID:lucaparisi91,项目名称:qmc,代码行数:17,代码来源:models.py

示例14: main

def main():
    arg_parser = argparse.ArgumentParser(
        description="extracts statistical information from a given CSV video file created with video2csv"
    )
    arg_parser.add_argument("--csvFile", help="the movie file to convert with ffmpeg")
    args = arg_parser.parse_args()

    if args.csvFile is None:
        print("no CSV file specified!")
    if not os.path.isfile(args.csvFile):
        print("No CSV file given or file does not exist")
        sys.exit(127)

    iframes = []
    pframes = []

    with open(args.csvFile) as csvfile:
        video_reader = csv.reader(csvfile, delimiter=";")
        video_reader.next()  # skip first line comment
        for row in video_reader:
            if "I" in row[1]:

                iframes.append(float(row[3]))
            else:

                pframes.append(float(row[3]))

        print("Number of I-frames: %s" % (len(iframes)))
        print("Average I-frame size: %s" % (np.average(iframes)))
        print("Number of P-frames: %s" % (len(pframes)))
        print("Average P-frame size: %s" % (np.average(pframes)))

        x1, y1 = list_to_ccdf(iframes)
        x2, y2 = list_to_ccdf(pframes)
        fig = plt.figure()
        ax = fig.add_subplot(1, 1, 1)

        ax.plot(x1, y1, label="IFrames")
        ax.plot(x2, y2, label="PFrames")
        plt.xscale("log")
        plt.xlabel("coded picture size in bytes")
        plt.ylabel(("P"))
        plt.grid()
        plt.legend()
        plt.show()
开发者ID:juliusf,项目名称:videoTools,代码行数:45,代码来源:CSVVideoStats.py

示例15: SMBH_mass

def SMBH_mass(save=False):

	fig=plot.figure()

	#a=ascii.read('data/BHmass_dist.dat',names=['mass','N'],data_start=1)
	#mass=(np.round(a['mass']*100.)/100.)
	#N=np.array(np.round(a['N']*100),dtype=np.int64)

	high=ascii.read('data/BH_mass_High_z.txt',names=['mass'])
	low=ascii.read('data/BH_mass_Low_z.txt',names=['mass'])

	loghigh=np.log10(high['mass'])
	loglow=np.log10(low['mass'])
	#ind1=np.arange(0,13,1)
	#ind2=np.arange(13,len(mass),1)

	#m1=np.repeat(mass[ind1],N[ind1])
	#w1=np.repeat(np.repeat(1./max(N[ind1]),len(ind1)),N[ind1])
	#m2=np.repeat(mass[ind2],N[ind2])
	#w2=np.repeat(np.repeat(1./max(N[ind2]),len(ind2)),N[ind2])

	low_bin=np.logspace(np.min(loglow),np.max(loglow),num=14)
	plot.hist(low['mass'],bins=low_bin,color='blue',weights=np.repeat(1./28,len(low)))
	high_bin=np.logspace(np.min(loghigh),np.max(loghigh),num=10)
	plot.hist(high['mass'],bins=high_bin,color='red',alpha=0.7,weights=np.repeat(1./28,len(high)))

	plot.annotate('Low Redshift (z < 3) Blazars',xy=(1.5e9,0.8),xycoords='data',fontsize=14,color='blue')
	plot.annotate('High Redshift (z > 3) Blazars',xy=(1.5e9,0.5),xycoords='data',fontsize=14,color='red')

	plot.xlim([5e7,5e10])
	plot.ylim([0,1.05])
	plot.xscale('log')
#	plot.yscale('log')
	plot.xlabel(r'Black Hole Mass (M$_{\odot}$)')
	plot.ylabel('Fraction of Known Blazars')
#	plot.title('Supermassive Black Hole Mass Evolution')

	if save:
		plot.savefig('SMBH_mass.png', bbox_inches='tight')
		plot.savefig('SMBH_mass.eps', bbox_inches='tight')
	else:
		plot.show()

	return
开发者ID:ComPair,项目名称:python,代码行数:44,代码来源:SciencePlots.py


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