本文整理汇总了Python中pylab.semilogy函数的典型用法代码示例。如果您正苦于以下问题:Python semilogy函数的具体用法?Python semilogy怎么用?Python semilogy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了semilogy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: plotHousing
def plotHousing(impression):
f=open('midWestHousingPrices.txt','r')
labels,prices=[],[]
for line in f:
year,quarter,price=line.split(' ')
label=year[2:4]+'\n'+quarter[:]
labels.append(label)
prices.append(float(price)/1000)
quarters=pylab.arange(len(labels))
width=0.8
if impression=='flat':
pylab.semilogy()
pylab.bar(quarters,prices,width)
pylab.xticks(quarters+width/2.0,labels)
pylab.title('Housing Prices in U.S. Midwest')
pylab.xlabel('Quarter')
pylab.ylabel('Average Price ($1000\'s)')
if impression=='flat':
pylab.ylim(10,10**3)
elif impression=='volatile':
pylab.ylim(180,220)
elif impression=='fair':
pylab.ylim(150,250)
else:
raise ValueError
开发者ID:starschen,项目名称:learning,代码行数:25,代码来源:16_2.py
示例2: plot
def plot(self, outputDirectory):
"""
Plot both the raw kinetics data and the Arrhenius fit versus
temperature. The plot is saved to the file ``kinetics.pdf`` in the
output directory. The plot is not generated if ``matplotlib`` is not
installed.
"""
# Skip this step if matplotlib is not installed
try:
import pylab
except ImportError:
return
Tlist = 1000.0/numpy.arange(0.4, 3.35, 0.05)
klist = numpy.zeros_like(Tlist)
klist2 = numpy.zeros_like(Tlist)
for i in range(Tlist.shape[0]):
klist[i] = self.reaction.calculateTSTRateCoefficient(Tlist[i])
klist2[i] = self.reaction.kinetics.getRateCoefficient(Tlist[i])
order = len(self.reaction.reactants)
klist *= 1e6 ** (order-1)
klist2 *= 1e6 ** (order-1)
pylab.semilogy(1000.0 / Tlist, klist, 'ok')
pylab.semilogy(1000.0 / Tlist, klist2, '-k')
pylab.xlabel('1000 / Temperature (1000/K)')
pylab.ylabel('Rate coefficient ({0})'.format(self.kunits))
pylab.savefig(os.path.join(outputDirectory, 'kinetics.pdf'))
pylab.close()
开发者ID:cainja,项目名称:RMG-Py,代码行数:30,代码来源:kinetics.py
示例3: plotEventFlop
def plotEventFlop(library, num, eventNames, sizes, times, events, filename = None):
from pylab import legend, plot, savefig, semilogy, show, title, xlabel, ylabel
import numpy as np
arches = sizes.keys()
bs = events[arches[0]].keys()[0]
data = []
names = []
for event, color in zip(eventNames, ['b', 'g', 'r', 'y']):
for arch, style in zip(arches, ['-', ':']):
if event in events[arch][bs]:
names.append(arch+'-'+str(bs)+' '+event)
data.append(sizes[arch][bs])
data.append(1e-3*np.array(events[arch][bs][event])[:,1])
data.append(color+style)
else:
print 'Could not find %s in %s-%d events' % (event, arch, bs)
semilogy(*data)
title('Performance on '+library+' Example '+str(num))
xlabel('Number of Dof')
ylabel('Computation Rate (GF/s)')
legend(names, 'upper left', shadow = True)
if filename is None:
show()
else:
savefig(filename)
return
开发者ID:Kun-Qu,项目名称:petsc,代码行数:27,代码来源:benchmarkExample.py
示例4: flipPlot
def flipPlot(minExp, maxExp):
"""Assumes minExp and maxExp positive integers; minExp < maxExp
Plots results of 2**minExp to 2**maxExp coin flips"""
ratios = []
diffs = []
xAxis = []
for exp in range(minExp, maxExp + 1):
xAxis.append(2 ** exp)
for numFlips in xAxis:
numHeads = 0
for n in range(numFlips):
if random.random() < 0.5:
numHeads += 1
numTails = numFlips - numHeads
ratios.append(numHeads / float(numTails))
diffs.append(abs(numHeads - numTails))
pylab.title('Difference Between Heads and Tails')
pylab.xlabel('Number of Flips')
pylab.ylabel('Abs(#Heads - #Tails)')
pylab.rcParams['lines.markersize'] = 10
pylab.semilogx()
pylab.semilogy()
pylab.plot(xAxis, diffs, 'bo')
pylab.figure()
pylab.title('Heads/Tails Ratios')
pylab.xlabel('Number of Flips')
pylab.ylabel('Heads/Tails')
pylab.plot(xAxis, ratios)
开发者ID:aytacozkan,项目名称:dsalgorithms,代码行数:29,代码来源:stochastic.py
示例5: flipPlot
def flipPlot(minExp,maxExp):
'''假定minExp和maxExp是正整数,并且minExp<maxExp,
绘制出2**minExp到2**maxExp次抛硬币的结果'''
ratios=[]
diffs=[]
xAxis=[]
for exp in range(minExp,maxExp+1):
xAxis.append(2**exp)
for numFlips in xAxis:
numHeads=0
for n in range(numFlips):
if random.random()<0.5:
numHeads+=1
numTails=numFlips-numHeads
ratios.append(numHeads/float(numTails))
diffs.append(abs(numHeads-numTails))
pylab.title('Difference Between Heads and Tails')
pylab.xlabel('Number of Flips')
pylab.semilogx()
pylab.semilogy()
pylab.ylabel('Abs(#Heads-#Tails)')
pylab.plot(xAxis,diffs,'bo')
pylab.figure()
pylab.title('Heads/Tails Ratios')
pylab.xlabel('Number of Flips')
pylab.semilogx()
pylab.ylabel('#Heads/#Tails')
pylab.plot(xAxis,ratios,'bo')
开发者ID:starschen,项目名称:learning,代码行数:28,代码来源:12_2统计推断和模拟.py
示例6: flipPlot
def flipPlot(minExp,maxExp):
ratios = []
diffs = []
xAxis = []
for exp in range(minExp,maxExp+1):
xAxis.append(2 ** exp)
print "xAxis: ", xAxis
for numFlips in xAxis:
numHeads = 0
for n in range(numFlips):
if random.random() < 0.5:
numHeads += 1
numTails = numFlips - numHeads
ratios.append(numHeads/float(numTails))
diffs.append(abs(numHeads - numTails))
pylab.figure()
pylab.title('Difference Between Heads and Tails')
pylab.xlabel('Number of Flips')
pylab.ylabel('Abs(#Heads - #Tails')
pylab.plot(xAxis, diffs, 'bo') #do not connect, show dot
pylab.semilogx()
pylab.semilogy()
pylab.figure()
pylab.plot(xAxis, ratios, 'bo') #do not connect, show dot
pylab.title('Heads/Tails Ratios')
pylab.xlabel('Number of Flips')
pylab.ylabel('Heads/Tails')
pylab.semilogx()
开发者ID:deodeta,项目名称:6.00SC,代码行数:31,代码来源:example07.py
示例7: qdisk_plot
def qdisk_plot(root):
# some labels
ylabels = ["Heating", r"$N_{\mathrm{hit}}$", r"$N_{\mathrm{hit}}/N_{\mathrm{tot}}$",
r"$T_{\mathrm{heat}}$", r"$T_{\mathrm{irrad}}$", r"$W_{\mathrm{irrad}}$"]
log_lin = [1,0,0,1,1,1]
p.figure(figsize=(9,10))
disk_diag = "diag_%s/%s.disk.diag" % (root, root)
# read the disk_diag file
a = ascii.read(disk_diag)
# cyce through the physical quantities and plot for each annulus
for j, name in enumerate(a.colnames[3:]):
p.subplot(3,2,j+1)
p.plot(a[name], ls="steps", c="k", linewidth=2)
p.ylabel(ylabels[j])
p.xlabel("Annulus")
if log_lin[j]:
p.semilogy()
p.savefig("qdisk_%s.png" % root, dpi=300)
开发者ID:agnwinds,项目名称:python,代码行数:28,代码来源:qdisk_plot.py
示例8: make_plots
def make_plots():
work_dir = "/u/cmutnik/work/upperSco_copy/finished/"
# Read in data
files = glob.glob(work_dir + "*.fits")
specs = []
for ff in range(len(files)):
spec = fits.getdata(files[ff])
if ff == 0:
tot0 = spec[1].sum()
spec[1] *= tot0 / spec[1].sum()
specs.append(spec)
# Plot
plt.clf()
for ff in range(len(files)):
legend = files[ff].split("/")[-1]
plt.semilogy(specs[ff][0], specs[ff][1], label=legend)
plt.legend(loc="lower left")
plt.xlim(0.7, 2.55)
return
开发者ID:AtomyChan,项目名称:JLU-python-code,代码行数:28,代码来源:jlu_plots.py
示例9: test_calcpow
def test_calcpow():
N1 = 128
N2 = 128
t1 = numpy.arange(N1)
t2 = numpy.arange(N2)
y1 = numpy.sin(t1*16.*numpy.pi/N1) + numpy.cos(t1*64.*numpy.pi/N1)
y2 = numpy.sin(t2*16.*numpy.pi/N2) + numpy.sin(t2*32.*numpy.pi/N1)
x = y1[:,None]*y2[None,:]
x += 0.1*numpy.random.normal(size=(N1,N2))
dt = 2.0
ell,Pl = calcpow(x,dt,Nl=100)
pylab.figure()
pylab.imshow(x)
pylab.colorbar()
pylab.figure()
pylab.semilogy(ell,Pl)
i = numpy.argmax(Pl)
print "scale of Pmax: %.3g arcmin" % (180.*60./ell[i])
pylab.show()
开发者ID:jakevdp,项目名称:Thesis,代码行数:26,代码来源:calcpow.py
示例10: plot_track_props
def plot_track_props(tracks, nx, ny, len_cutoff=20):
pl.ioff()
wdist = wraparound_dist(nx, ny)
val_fig = pl.figure()
area_fig = pl.figure()
psn_fig = pl.figure()
delta_vals = []
delta_dists = []
for tr in tracks:
if len(tr) < len_cutoff:
continue
idxs, regs = zip(*tr)
delta_vals.extend([abs(regs[idx].val - regs[idx + 1].val) for idx in range(len(regs) - 1)])
dists = [wdist(regs[i].loc, regs[i + 1].loc) for i in range(len(regs) - 1)]
delta_dists.extend([abs(dists[idx] - dists[idx + 1]) for idx in range(len(dists) - 1)])
pl.figure(val_fig.number)
pl.plot(idxs, [reg.val for reg in regs], "s-", hold=True)
pl.figure(area_fig.number)
pl.semilogy(idxs, [reg.area for reg in regs], "s-", hold=True)
pl.figure(psn_fig.number)
pl.plot(idxs[:-1], dists, "s-", hold=True)
pl.figure(val_fig.number)
pl.savefig("val_v_time.pdf")
pl.figure(area_fig.number)
pl.savefig("area_v_time.pdf")
pl.figure(psn_fig.number)
pl.savefig("psn_v_time.pdf")
pl.figure()
pl.hist(delta_vals, bins=pl.sqrt(len(delta_vals)))
pl.savefig("delta_vals.pdf")
pl.figure()
pl.hist(delta_dists, bins=pl.sqrt(len(delta_dists)))
pl.savefig("delta_dists.pdf")
pl.close("all")
开发者ID:kwmsmith,项目名称:field-trace,代码行数:34,代码来源:test_tracking.py
示例11: demo
def demo():
import pylab
# The module normalize is not part of the osrefl code base.
from reflectometry.reduction import normalize
from .examples import ng7 as dataset
spec = dataset.spec()[0]
water = WaterIntensity(D2O=20,probe=spec.probe)
spec.apply(normalize())
theory = water.model(spec.Qz,spec.detector.wavelength)
pylab.subplot(211)
pylab.title('Data normalized to water scattering (%g%% D2O)'%water.D2O)
pylab.xlabel('Qz (inv Ang)')
pylab.ylabel('Reflectivity')
pylab.semilogy(spec.Qz,theory,'-',label='expected')
scale = theory[0]/spec.R[0]
pylab.errorbar(spec.Qz,scale*spec.R,scale*spec.dR,fmt='.',label='measured')
spec.apply(water)
pylab.subplot(212)
#pylab.title('Intensity correction factor')
pylab.xlabel('Slit 1 opening (mm)')
pylab.ylabel('Incident intensity')
pylab.yscale('log')
pylab.errorbar(spec.slit1.x,spec.R,spec.dR,fmt='.',label='correction')
pylab.show()
开发者ID:reflectometry,项目名称:osrefl,代码行数:29,代码来源:ratiocor.py
示例12: new_draw_parcel_trace
def new_draw_parcel_trace(Tb, PLCL, Press):
# Convert Pressures to log scale
Pfact = np.multiply(skewness,np.log10(np.divide(1000., Press)))
parcelT = []
flag = 1
for p in range(len(Press)):
if Press[p] >= PLCL:
newTB = ((Tb + 273.) * (Press[p]/Press[0]) ** (287.04/1004.)) - 273.
parcelT.append(newTB)
else:
if flag:
if p == 0:
moists = draw_moist_adiabats(0, 1, Tb, 0)
else:
moists = draw_moist_adiabats(0,1,parcelT[p-1], (p - 1 + len(press_levels) - len(Press)))
for m in moists:
parcelT.append(m)
flag = 0
minlen = min(len(parcelT), len(Pfact))
dry_parcel_trace = np.add(parcelT[:minlen], Pfact[:minlen])
pylab.semilogy(dry_parcel_trace,Press[:minlen],\
basey=10, color = 'brown', linestyle = 'dotted',\
linewidth = 1.5)
开发者ID:lmadaus,项目名称:old_wrf_plotting_scripts,代码行数:32,代码来源:plot_wrf_skewt.py
示例13: showGrowth
def showGrowth(lower, upper):
log = []
linear = []
quadratic = []
logLinear = []
exponential = []
for n in range(lower, upper+1):
log.append(math.log(n, 2))
linear.append(n)
logLinear.append(n*math.log(n, 2))
quadratic.append(n**2)
exponential.append(2**n)
pylab.plot(log, label = 'log')
pylab.plot(linear, label = 'linear')
pylab.legend(loc = 'upper left')
pylab.figure()
pylab.plot(linear, label = 'linear')
pylab.plot(logLinear, label = 'log linear')
pylab.legend(loc = 'upper left')
pylab.figure()
pylab.plot(logLinear, label = 'log linear')
pylab.plot(quadratic, label = 'quadratic')
pylab.legend(loc = 'upper left')
pylab.figure()
pylab.plot(quadratic, label = 'quadratic')
pylab.plot(exponential, label = 'exponential')
pylab.legend(loc = 'upper left')
pylab.figure()
pylab.plot(quadratic, label = 'quadratic')
pylab.plot(exponential, label = 'exponential')
pylab.semilogy()
pylab.legend(loc = 'upper left')
return
开发者ID:KWresearch,项目名称:teacher-mitArchive-git,代码行数:33,代码来源:showGrowth.py
示例14: demo_perfidious
def demo_perfidious(n):
plt.figure()
r = (np.arange(n)+1)/float(n+1)
bases = [(PowerBasis(), "Power"),
(ChebyshevBasis(interval=(1./(n+1),n/float(n+1))),"Chebyshev"),
(LagrangeBasis(interval=(1./(n+1),n/float(n+1))),"Lagrange"),
(LagrangeBasis(r),"Specialized Lagrange")]
xs = np.linspace(0,1,50*n)
for (i,(b,l)) in enumerate(bases):
p = b.from_roots(r)
plt.subplot(len(bases),1,i+1)
plt.semilogy(xs,np.abs(p(xs)),label=l)
plt.xlim(0,1)
plt.ylim(min=1)
for j in range(n):
plt.axvline((j+1)/float(n+1),linestyle=":",color="black")
plt.legend(loc="best")
print b.points
print p.coefficients
plt.subplot(len(bases),1,1)
plt.title('The "perfidious polynomial" for n=%d' % n)
开发者ID:aarchiba,项目名称:scikits.polynomial,代码行数:26,代码来源:demo_numerical_stability.py
示例15: hanning_standard_plot
def hanning_standard_plot(data, rate):
sample_length = len(data)
k = arange(sample_length)
period = sample_length / rate
freqs = (k / period)[range(sample_length / 2)] #right-side frequency range
Y = (fft(data * np.hanning(sample_length)) / sample_length)[range(sample_length / 2)]
semilogy(freqs, abs(Y))
开发者ID:rileyjshaw,项目名称:mean-tone,代码行数:7,代码来源:fft_comparisons.py
示例16: flipPlot
def flipPlot(minExp, maxExp):
"""minExpとmaxExpは minExp < maxExp を満たす正の整数とする
2**minExp から 2**maxExp 回のコイン投げの結果をプロットする"""
ratios = []
diffs = []
xAxis = []
for exp in range(minExp, maxExp + 1):
xAxis.append(2**exp)
for numFlips in xAxis:
numHeads = 0
for n in range(numFlips):
if random.random() < 0.5:
numHeads += 1
numTails = numFlips - numHeads
ratios.append(numHeads / float(numTails))
diffs.append(abs(numHeads - numTails))
pylab.title('Difference Between Heads and Tails ')
pylab.xlabel('Number of Flips')
pylab.ylabel('Abs(#Heads - #Tails)')
pylab.semilogx()
pylab.semilogy()
pylab.plot(xAxis, diffs, 'bo')
pylab.figure()
pylab.title('Heads/Tails Ratios')
pylab.xlabel('Number of Flips')
pylab.ylabel('#Heads/#Tails')
pylab.semilogx()
pylab.semilogy()
pylab.plot(xAxis, ratios, 'bo')
开发者ID:Tnoriaki,项目名称:pyintro,代码行数:29,代码来源:12.3.py
示例17: standard_plot
def standard_plot(data, rate):
sample_length = len(data)
k = arange(sample_length)
period = sample_length / rate
freqs = (k / period)[range(sample_length / 2)] #right-side frequency range
Y = (fft(data) / sample_length)[range(sample_length / 2)]
semilogy(freqs, abs(Y)) # plotting the spectrum
开发者ID:rileyjshaw,项目名称:mean-tone,代码行数:7,代码来源:fft_comparisons.py
示例18: plotDependencyEPS
def plotDependencyEPS():
"""Plot thoretical dependency between n_components and eps"""
# range of admissible distortions
eps_range = np.linspace(0.01, 0.99, 100)
# range of number of samples to embed
n_samples_range = np.logspace(2, 6, 5)
colors = pl.cm.Blues(np.linspace(0.3, 1.0, len(n_samples_range)))
pl.figure()
for n_samples, color in zip(n_samples_range, colors):
min_n_components = johnson_lindenstrauss_min_dim(n_samples, \
eps=eps_range)
pl.semilogy(eps_range, min_n_components, color=color)
pl.legend(["n_samples = %d" % n for n in n_samples_range], \
loc="upper right")
pl.xlabel("Distortion eps")
pl.ylabel("Minimum number of dimensions")
pl.title("Johnson-Lindenstrauss bounds:\nn_components vs eps")
pl.show()
开发者ID:AkiraKane,项目名称:Python,代码行数:25,代码来源:the_Johnson-Lindenstrauss_bound_for_embedding_with_random_projections.py
示例19: plotHist
def plotHist(self):
p.figure()
p.semilogy(self.counts.keys(), self.counts.values(), '.')
p.xlabel('Log-return')
p.ylabel('Count')
p.title(self.symbol)
p.show()
开发者ID:tinybike,项目名称:snitch,代码行数:7,代码来源:snitch.py
示例20: testPlot2
def testPlot2(trials=51, maxsteps=5000):
f = FunctionWrapper(trials, OptimumJumper(StochQuad(noiseLevel=10, curvature=1), jumptime=1000, jumpdist_std=1))
for aclass, aparams in [#(SGD, {'learning_rate':0.1}),
#(SGD, {'learning_rate':0.01}),
#(AveragingSGD, {'learning_rate':0.01}),
#(AveragingSGD, {'learning_rate':0.01, 'fixedDecay':0.1}),
#(AveragingSGD, {'learning_rate':0.01, 'fixedDecay':0.1}),
#(AveragingSGD, {'learning_rate':0.1}),
#(AveragingSGD, {'learning_rate':1.0}),
(AveragingOracle, {}),
(AveragingOracle, {"fixedDecay":0.1}),
#(AveragingOracle, {"fixedDecay":0.01}),
(AdaptivelyAveragingOracle, {}),
#(AdaGrad, {'init_lr':0.3}),
#(Amari, {'init_lr':0.1, 'time_const':100}),
#(RMSProp, {'init_lr':0.1}),
(OracleSGD, {}),
#(vSGD, {'verbose':False}),
#(vSGDfd, {}),
]:
ls = lossTraces(fwrap=f, aclass=aclass, dim=trials,
maxsteps=maxsteps, algoparams=aparams)
plotWithPercentiles(ls, algo_colors[aclass], aclass.__name__)
pylab.semilogy()
pylab.xlim(0, maxsteps)
pylab.legend()
pylab.show()
开发者ID:Andres-Hernandez,项目名称:py-optim,代码行数:27,代码来源:test_figs.py
注:本文中的pylab.semilogy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论