本文整理汇总了Python中matplotlib.pylab.semilogy函数的典型用法代码示例。如果您正苦于以下问题:Python semilogy函数的具体用法?Python semilogy怎么用?Python semilogy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了semilogy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: unteraufgabe_g
def unteraufgabe_g():
# Sampling punkte
x = np.linspace(0.0,1.0,1000)
N = np.arange(2,16)
LU = np.ones_like(N,dtype=np.floating)
LT = np.ones_like(N,dtype=np.floating)
# Approximiere Lebesgue-Konstante
for i,n in enumerate(N):
################################################################
#
# xU = np.linspace(0.0,1.0,n)
#
# LU[i] = ...
#
# j = np.arange(n+1)
# xT = 0.5*(np.cos((2.0*j+1.0)/(2.0*(n+1.0))*np.pi) + 1.0)
#
# LT[i] = ...
#
################################################################
continue
# Plot
plt.figure()
plt.semilogy(N,LU,"-ob",label=r"Aequidistante Punkte")
plt.semilogy(N,LT,"-og",label=r"Chebyshev Punkte")
plt.grid(True)
plt.xlim(N.min(),N.max())
plt.xlabel(r"$n$")
plt.ylabel(r"$\Lambda^{(n)}$")
plt.legend(loc="upper left")
plt.savefig("lebesgue.eps")
开发者ID:Xelaju,项目名称:NumMeth,代码行数:34,代码来源:interp.py
示例2: unteraufgabe_d
def unteraufgabe_d():
n = np.arange(2,21,2)
xs = [x02,x04,x06,x08,x10,x12,x14,x16,x18,x20]
f = lambda x: np.sin(10*x*np.cos(x))
residuals = np.zeros_like(n,dtype=np.floating)
condition = np.ones_like(n,dtype=np.floating)
for i, x in enumerate(xs):
b = f(x)
A = interp_monom(x)
alpha = solve(A,b)
residuals[i] = norm(np.dot(A,alpha) - b)
condition[i] = cond(A)
plt.figure()
plt.plot(n,residuals,"-o")
plt.grid(True)
plt.xlabel(r"$n$")
plt.ylabel(r"$\|A \alpha - b\|_2$")
plt.savefig("residuals.eps")
plt.figure()
plt.semilogy(n,condition,"-o")
plt.grid(True)
plt.xlabel(r"$n$")
plt.ylabel(r"$\log(\mathrm{cond}(A))$")
plt.savefig("condition.eps")
开发者ID:Xelaju,项目名称:NumMeth,代码行数:28,代码来源:interp.py
示例3: plot
def plot(coefs_files, digit=0, mixture=0, axis=0):
import numpy as np
import matplotlib.pylab as plt
import amitgroup as ag
for coefs_file in coefs_files:
coefs_data = np.load(coefs_file)
var = coefs_data['prior_var']
samples = coefs_data['samples']
llh_var = coefs_data['llh_var']
var_flat = ag.util.wavelet.smart_flatten(var[digit,mixture,axis])
last_i = len(var_flat)-1
plt.xlim((0, last_i))
#imdef = ag.util.DisplacementFieldWavelet((32, 32), 'db4', penalty=100
if len(coefs_files) == 1:
add = ""
else:
add = " ({0})".format(coefs_file.name)
plt.subplot(121)
plt.semilogy(1/var_flat, label="ML"+add)
plt.legend(loc=0)
plt.xlabel('Coefficient')
plt.ylabel('Precision $\lambda$')
plt.xlim((0, 63))
plt.subplot(122)
plt.imshow(1/llh_var[digit,mixture], interpolation='nearest')
plt.xlabel("Likelihood precision $\lambda'$")
plt.colorbar()
plt.show()
开发者ID:EdwardBetts,项目名称:vision-research,代码行数:34,代码来源:plot_intensity_coefs.py
示例4: demo
def demo():
'''
Load and plot a few CIB spectra.
'''
# define ell array.
l = np.arange(100,4000)
# get dictionary of CIBxCIB spectra.
cl_cibcib = get_cl_cibcib(l)
# plot
import matplotlib.pylab as pl
pl.ion()
lw=2
fs=18
leg = []
pl.clf()
for band in ['857','545','353']:
pl.semilogy(l, cl_cibcib['545',band],linewidth=lw)
leg.append('545 x '+band)
pl.xlabel(r'$\ell$',fontsize=fs)
pl.ylabel(r'$C_\ell^{TT, CIB} [\mu K^2]$',fontsize=fs)
pl.ylim(5e-2,6e3)
pl.legend(leg, fontsize=fs)
开发者ID:rkeisler,项目名称:cib_planck,代码行数:25,代码来源:cib_planck.py
示例5: 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 Q" + quarter[1]
labels.append(label)
prices.append(float(price)/1000)
#柱的X坐标
quarters = np.arange(len(labels))
#柱宽
width = 0.5
if impression == 'flat':
plt.semilogy()
plt.bar(quarters, prices, width, color='r')
plt.xticks(quarters + width / 2.0, labels)
plt.title("美国中西部各州房价")
plt.xlabel("季度")
plt.ylabel("平均价格($1000)")
if impression == 'flat':
plt.ylim(10, 10**3)
elif impression == "volatile":
plt.ylim(180, 220)
elif impression == "fair":
plt.ylim(150, 250)
else:
raise ValueError("Invalid input.")
开发者ID:xiaohu2015,项目名称:ProgrammingPython_notes,代码行数:32,代码来源:chapter16.py
示例6: testPlotFrequencyDomain
def testPlotFrequencyDomain():
filename = baseFilename % 0
rawData = dataImport.readADSFile(filename)
rawSps = 32000
downSampled = _downSample(rawData, rawSps)
downSampledLinear = _downSampleLinearInterpolate(rawData, rawSps)
rawTimes = range(len(rawData))
times = [float(x) * rawSps / samplesPerSecond for x in range(len(downSampled))]
#pylab.plot(times, downSampled)
#pylab.plot(rawTimes, rawData)
#pylab.plot(times, downSampledLinear)
pylab.show()
index = 0
fdat = applyTransformsToWindows(getFFTWindows(downSampled), True)[index]
fdatLin = applyTransformsToWindows(getFFTWindows(downSampledLinear), True)[index]
#print [str(x) for x in zip(fdat, fdatLin)]
frequencies = [i * samplesPerSecond / windowSize for i in range(len(fdat))]
pylab.semilogy(frequencies, fdat)
pylab.semilogy(frequencies, fdatLin)
pylab.grid(True)
pylab.show()
开发者ID:NickStupich,项目名称:PythonDFT-Analysis,代码行数:26,代码来源:fftDataExtraction.py
示例7: plot_misfit_curves
def plot_misfit_curves(items, threshold, threshold_is_upper_limit,
logarithmic, component, pretty_misfit_name, filename):
plt.close()
crossing_periods = []
crossing_values = []
for item in items:
if logarithmic:
plt.semilogy(item["periods"], item["misfit_values"])
else:
plt.plot(item["periods"], item["misfit_values"])
# Find the threshold.
point = rightmost_threshold_crossing(
item["periods"], item["misfit_values"], threshold,
threshold_is_upper_limit)
crossing_periods.append(point[0])
crossing_values.append(point[1])
plt.title("%s misfit curves for component %s" % (
pretty_misfit_name, component))
plt.xlabel("Lowpass Period [s]")
plt.ylabel("%s" % pretty_misfit_name)
x = items[0]["periods"][0] - 0.5, items[0]["periods"][-1] + 0.5
plt.hlines(threshold, x[0], x[1],
linestyle="--", color="0.5")
plt.scatter(crossing_periods, crossing_values, color="0.2", s=10,
zorder=5)
plt.xlim(*x)
plt.savefig(filename)
开发者ID:amir-allam,项目名称:wfdiff,代码行数:34,代码来源:visualization.py
示例8: plottingTimeConsumptions
def plottingTimeConsumptions(titleString, trialedFuncs, timesToPlot):
""" titleString...String to be displayed in Title
trialedFuncs...list of the strings of the trialed functions
timesToPlot...dim [numberTrials, numberFunctions]
"""
# plt.figure()
for cnt in range(len(trialedFuncs)):
if 'vectorized' in trialedFuncs[cnt]:
lineStyle = '--'
elif 'faverage' in trialedFuncs[cnt]:
lineStyle = '--'
else:
lineStyle = '-'
plt.semilogy(timesToPlot[cnt], label=trialedFuncs[cnt], linestyle=lineStyle, marker='o')
plt.xticks(range(len(timesToPlot[1])))
plt.xlabel('trials [1]')
plt.ylabel('Time per Trial [s]')
plt.grid(which='major')
plt.grid(which='minor', linestyle='--')
plt.title(titleString)
yMin, yMax = plt.ylim()
newYMin = 10 ** np.floor(np.log10(yMin))
plt.ylim(newYMin, yMax)
plt.legend(bbox_to_anchor=(1.01, 1), loc=2, borderaxespad=0.)
plt.show()
开发者ID:esarradj,项目名称:acoular,代码行数:25,代码来源:sharedFunctions.py
示例9: plotFittingResults
def plotFittingResults(self):
"""
Plot results of Rmax optimization procedure and best fit of the experimental data
"""
_listFitQ = [tmp.getValue() for tmp in self.getDataOutput().getScatteringFitQ()]
_listFitValues = [tmp.getValue() for tmp in self.getDataOutput().getScatteringFitValues()]
_listExpQ = [tmp.getValue() for tmp in self.getDataInput().getExperimentalDataQ()]
_listExpValues = [tmp.getValue() for tmp in self.getDataInput().getExperimentalDataValues()]
#_listExpStdDev = None
#if self.getDataInput().getExperimentalDataStdDev():
# _listExpStdDev = [tmp.getValue() for tmp in self.getDataInput().getExperimentalDataStdDev()]
#if _listExpStdDev:
# pylab.errorbar(_listExpQ, _listExpValues, yerr=_listExpStdDev, linestyle='None', marker='o', markersize=1, label="Experimental Data")
# pylab.gca().set_yscale("log", nonposy='clip')
#else:
# pylab.semilogy(_listExpQ, _listExpValues, linestyle='None', marker='o', markersize=5, label="Experimental Data")
pylab.semilogy(_listExpQ, _listExpValues, linestyle='None', marker='o', markersize=5, label="Experimental Data")
pylab.semilogy(_listFitQ, _listFitValues, label="Fitting curve")
pylab.xlabel('q')
pylab.ylabel('I(q)')
pylab.suptitle("RMax : %3.2f. Fit quality : %1.3f" % (self.getDataInput().getRMax().getValue(), self.getDataOutput().getFitQuality().getValue()))
pylab.legend()
pylab.savefig(os.path.join(self.getWorkingDirectory(), "gnomFittingResults.png"))
pylab.clf()
开发者ID:antolinos,项目名称:edna,代码行数:26,代码来源:EDPluginExecGnomv0_1.py
示例10: main
def main():
t1 = time()
assert 0, "This example needs easily accessible I and F"
imdef, info = ag.stats.bernoulli_model(F, I, stepsize_scale_factor=1.0, penalty=0.1, rho=1.0, last_level=4, tol=0.001, \
start_level=2, wavelet='db2')
Fdef = imdef.deform(F)
t2 = time()
print "Time:", t2-t1
PLOT = True
if PLOT:
import matplotlib.pylab as plt
x, y = imdef.meshgrid()
Ux, Uy = imdef.deform_map(x, y)
ag.plot.deformation(F, I, imdef)
#Also print some info before showing
print "Iterations (per level):", info['iterations_per_level']
plt.show()
# Print
plt.semilogy(info['costs'])
plt.show()
开发者ID:amitgroup,项目名称:amitgroup,代码行数:27,代码来源:bernoulli_deformation.py
示例11: kmeans_graph
def kmeans_graph(k, newClusters):
plt.figure()
plt.title('Clustering Result, k = %i'%(k+1))
plt.xlabel('Number of counties in cluster')
plt.ylabel('Population Count')
plt.semilogy()
colors = ['ro', 'bo', 'go', 'yo', 'r^', 'b^']
for i, v in enumerate(newClusters):
print i, v
plt.plot(v, colors[i])
开发者ID:ZachPerkitny,项目名称:Python-K-Means-Algorithm,代码行数:10,代码来源:main.py
示例12: PlotFit
def PlotFit(traj_diff, p):
"""
Given a trajectory difference and p=(lyapExponent, lyapPrefactor),
plot |traj_diff| and the fit on a semilog y axis.
"""
pylab.plot(scipy.fabs(traj_diff), 'b-', linewidth=4)
fit = scipy.exp(p[1] + p[0] * scipy.arange(len(traj_diff)))
pylab.semilogy(fit, 'r-', linewidth=2)
pylab.show()
开发者ID:acaballero6270,项目名称:py4science,代码行数:10,代码来源:ChaosLyapunov.py
示例13: makePlot
def makePlot(xVals, yVals, title, xLabel, yLabel, style, logX=False, logY=False):
"""用给定的标题和标签绘制xVals和yVals
"""
plt.figure()
plt.title(title)
plt.xlabel(xLabel)
plt.ylabel(yLabel)
plt.plot(xVals, yVals, style)
if logX:
plt.semilogx()
if logY:
plt.semilogy()
开发者ID:xiaohu2015,项目名称:ProgrammingPython_notes,代码行数:12,代码来源:chapter12.py
示例14: viz
def viz(self, names, title=None, lw=None,
save=False, savename=None):
'''
NAMES can be
a name: 'mary'
space-separated names: 'mary james', or
a list of names: ['mary','james'].
Any capitalization works.
'''
pl.clf()
leg = []
colors = colorz()
if isinstance(names, basestring):
names = names.split()
if lw is None: lw = 4.0 - 0.3*np.log(len(names))
for iname,name_ in enumerate(names):
name = name_.lower().capitalize()
if name not in self.data:
print '%s is not in database.'%name
return
leg.append(name)
v = self.data[name]
years = np.sort(v.keys())
rank = np.array([v[year]['rank'] for year in years])
cnt = np.array([v[year]['cnt'] for year in years])
# rank
pl.subplot(1,2,1)
pl.semilogy(years, rank, '-', linewidth=lw, color=colors[iname])
pl.ylabel('Rank')
pl.ylim(1e5,1)
pl.grid('on')
# percentage
pl.subplot(1,2,2)
pl.semilogy(years, cnt*100, '-', linewidth=lw, color=colors[iname])
pl.ylabel('Share (%)')
pl.ylim(1e-4,10)
pl.grid('on')
# legend & title
for i in [1,2]:
pl.subplot(1,2,i)
pl.legend(leg, loc='lower left', fontsize=11, framealpha=0.9)
if title is not None:
pl.title(title)
pl.show()
if save:
if savename is None:
savename = '%s.png'%('_'.join(names))
print 'saving %s'%savename
pl.savefig(savename)
开发者ID:rkeisler,项目名称:babynames,代码行数:52,代码来源:names.py
示例15: main
def main():
"""
NAME
lowes.py
DESCRIPTION
Plots Lowes spectrum for input IGRF-like file
SYNTAX
lowes.py [options]
OPTIONS:
-h prints help message and quits
-f FILE specify file name with input data
-d date specify desired date
-r read desired dates from file
-n normalize to dipole term
INPUT FORMAT:
l m g h
"""
norm=0
if '-f' in sys.argv:
ind=sys.argv.index('-f')
file=sys.argv[ind+1]
data=np.loadtxt(file)
dates=[2000]
elif '-d' in sys.argv:
ind=sys.argv.index('-d')
dates=[float(sys.argv[ind+1])]
elif '-r' in sys.argv:
ind=sys.argv.index('-r')
dates=np.loadtxt(sys.argv[ind+1])
if '-n' in sys.argv: norm=1
if len(sys.argv)!=0 and '-h' in sys.argv:
print(main.__doc__)
sys.exit()
plt.semilogy()
plt.xlabel('Degree (l)')
plt.ylabel('Power ($\mu$T$^2$)')
labels=[]
for date in dates:
if date!=2000:
gh=pmag.doigrf(0,0,0,date,coeffs=1)
data=pmag.unpack(gh)
Ls,Rs=pmag.lowes(data)
labels.append(str(date))
print(date,Rs[0])
if norm==1:
Rs=old_div(np.array(Rs),Rs[0])
#plt.plot(Ls,Rs,'ro')
plt.plot(Ls,Rs,linewidth=2)
plt.legend(labels,'upper right')
plt.draw()
input()
开发者ID:CrabGit334,项目名称:PmagPy,代码行数:52,代码来源:lowes.py
示例16: errorVsDegree
def errorVsDegree(ndegrees, npts=40, filename=None, **kwargs):
degrees = numpy.array(range(ndegrees),dtype=float)
errs = numpy.zeros_like(degrees)
ntrials=10
for i, deg in enumerate(degrees):
for trial in range(ntrials):
p, x, y, err = noisyDataPolyFit(deg, returnError=True)
errs[i] = errs[i] + err
errs[i] = errs[i]/ntrials
plt.semilogy(degrees,errs,'go-')
plt.xlabel('Degree')
plt.ylabel('Squared Error')
outputPlot(filename)
开发者ID:ljdursi,项目名称:ML-for-scientists,代码行数:13,代码来源:biasvariance.py
示例17: clear
def clear(n, p, steps):
"""假定n和steps是正整数,p是浮点数,
n是分子的初始数量
p是分子被清除的概率
steps是模拟的时间
"""
numRemaining = [n]
for t in range(1, steps+1):
numRemaining.append(numRemaining[-1]*(1-p))
plt.plot(numRemaining)
plt.xlabel('Time')
plt.ylabel('Molecules Remianing')
plt.title('Clearance of Drug')
plt.semilogy()
开发者ID:xiaohu2015,项目名称:ProgrammingPython_notes,代码行数:14,代码来源:chapter12.py
示例18: inSampleErrorVsDegree
def inSampleErrorVsDegree(ndegrees, npts=40, filename=None, **kwargs):
degrees = numpy.array(range(ndegrees),dtype=float)
errs = numpy.zeros_like(degrees)
ntrials=10
for i, deg in enumerate(degrees):
for trial in range(ntrials):
p, x, y = noisyDataPolyFit(deg)
fitfun = numpy.poly1d(p)
errs[i] = errs[i] + sum((fitfun(x)-y)**2)
errs[i] = errs[i]/ntrials
plt.semilogy(degrees,errs,'go-')
plt.xlabel('Degree')
plt.ylabel('In-Sample Squared Error')
outputPlot(filename)
开发者ID:ljdursi,项目名称:ML-for-scientists,代码行数:14,代码来源:biasvariance.py
示例19: __plotRMaxSearchResults
def __plotRMaxSearchResults(self):
"""
Plot results of Rmax optimization procedure and best fit of the experimental data
"""
cm = matplotlib.cm.get_cmap('cool')
#pylab.rcParams['figure.figsize'] = 6, 5
for itr in range(self.__iNbGnomSeries):
rMaxList = []
fitQualityList = []
for idx in range(self.__rMaxDivide + 1):
rMaxList.append(self.__xsGnomPlugin[(itr,idx)].getDataInput().getRMax().getValue())
fitQualityList.append(self.__xsGnomPlugin[(itr,idx)].getDataOutput().getFitQuality().getValue())
#pylab.plot(fitQualityList, marker='o', color=cm(1.0*itr/(self.__iNbGnomSeries-1)), markersize=5, label="Iteration # %d" % itr)
pylab.figure(self.__iNbGnomSeries+1, figsize=(6,5))
pylab.plot(rMaxList, fitQualityList, linestyle='None', marker='o', color=cm(1.0*(itr+1)/self.__iNbGnomSeries), markersize=5, label="Iteration # %d" % itr)
pylab.figure(itr+1, figsize=(6,5))
pylab.plot(rMaxList, fitQualityList, linestyle='-', marker='o', markersize=5, label="Iteration # %d" % itr)
pylab.xlabel(u"Rmax / \u00c5")
pylab.ylabel('Fit quality')
pylab.legend(loc=4)
pylab.savefig(os.path.join(self.getWorkingDirectory(),"rMaxSearchResults-%d.png" % (itr+1)))
pylab.figure(self.__iNbGnomSeries+1, figsize=(6,5))
pylab.xlabel(u"Rmax / \u00c5")
pylab.ylabel('Fit quality')
pylab.suptitle("Optimized value of RMax : %3.2f Maximal fit quality : %1.3f" % (self.__edPluginExecGnom.getDataInput().getRMax().getValue(),self.__edPluginExecGnom.getDataOutput().getFitQuality().getValue()))
pylab.legend(loc=4)
pylab.savefig(os.path.join(self.getWorkingDirectory(),"rMaxSearchResults.png"))
pylab.clf()
_listFitQ = [tmp.getValue() for tmp in self.__edPluginExecGnom.getDataOutput().getScatteringFitQ()]
_listFitValues = [tmp.getValue() for tmp in self.__edPluginExecGnom.getDataOutput().getScatteringFitValues()]
_listExpQ = [tmp.getValue() for tmp in self.__edPluginExecGnom.getDataInput().getExperimentalDataQ()]
_listExpValues = [tmp.getValue() for tmp in self.__edPluginExecGnom.getDataInput().getExperimentalDataValues()]
pylab.semilogy(_listExpQ, _listExpValues, linestyle='None', marker='o', markersize=5, label="Experimental Data")
pylab.semilogy(_listFitQ, _listFitValues, label="Fitting curve")
pylab.xlabel(u"q / \u00c5$^{-1}$")
pylab.ylabel('I(q)')
pylab.suptitle("RMax : %3.2f Fit quality : %1.3f" % (self.__edPluginExecGnom.getDataInput().getRMax().getValue(),self.__edPluginExecGnom.getDataOutput().getFitQuality().getValue()))
pylab.legend()
pylab.savefig(os.path.join(self.getWorkingDirectory(),"gnomFittingResults.png"))
pylab.clf()
if self.__bPlotFit:
for gnomJob in self.__xsGnomPlugin.itervalues():
gnomJob.plotFittingResults()
self.__edPluginExecGnom.plotFittingResults()
开发者ID:antolinos,项目名称:edna,代码行数:50,代码来源:EDPluginControlSolutionScatteringv0_2.py
示例20: chisq
def chisq(df, fig=None, columns=['teff','logg','fe'], **kwargs):
"""Make a multi-panel plot of chisq
"""
ncols = len(columns)
if fig is None:
fig,axL = plt.subplots(ncols=ncols)
else:
axL = fig.get_axes()
i = 0
for col in columns:
plt.sca(axL[i])
plt.semilogy()
plt.plot(df[col],df['chisq'],**kwargs)
i+=1
开发者ID:petigura,项目名称:specmatch-syn,代码行数:15,代码来源:output.py
注:本文中的matplotlib.pylab.semilogy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论