本文整理汇总了Python中pylab.semilogy方法的典型用法代码示例。如果您正苦于以下问题:Python pylab.semilogy方法的具体用法?Python pylab.semilogy怎么用?Python pylab.semilogy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylab
的用法示例。
在下文中一共展示了pylab.semilogy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: blackbody_color_vs_temperature_plot
# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import semilogy [as 别名]
def blackbody_color_vs_temperature_plot (T_list, title, filename):
'''Draw a color vs temperature plot for the given temperature range.'''
num_T = len (T_list)
rgb_list = numpy.empty ((num_T, 3))
for i in range (0, num_T):
T_i = T_list [i]
xyz = blackbody_color (T_i)
rgb_list [i] = colormodels.rgb_from_xyz (xyz)
# Note that b and g become negative for low T.
# MatPlotLib skips those on the semilog plot.
plots.color_vs_param_plot (
T_list,
rgb_list,
title,
filename,
plotfunc = pylab.semilogy,
tight = True,
xlabel = r'Temperature (K)',
ylabel = r'RGB Color')
示例2: plot_stepsize
# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import semilogy [as 别名]
def plot_stepsize(self):
"""
Plots the step-size.
"""
import pylab as P
P.semilogy(N.diff(self.t),drawstyle='steps-post')
P.title(self.problem.name)
P.ylabel('Step length')
P.xlabel('Number of steps')
P.show()
示例3: fit
# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import semilogy [as 别名]
def fit(self, error_rate=0.05, semilogy=False, Nfit=100,
error_kwargs={"lw":1, "color":"black", "alpha":0.2},
fit_kwargs={"lw":2, "color":"red"}):
self.mus = []
self.sigmas = []
self.amplitudes = []
self.fits = []
pylab.figure(1)
pylab.clf()
pylab.bar(self.X, self.Y, width=0.85, ec="k")
for x in range(Nfit):
# 10% error on the data to add errors
self.E = [scipy.stats.norm.rvs(0, error_rate) for y in self.Y]
#[scipy.stats.norm.rvs(0, self.std_data * error_rate) for x in range(self.N)]
self.result = scipy.optimize.least_squares(self.func,
(self.guess_mean, self.guess_std, self.guess_amp))
mu, sigma, amplitude = self.result['x']
pylab.plot(self.X, amplitude * scipy.stats.norm.pdf(self.X, mu,sigma),
**error_kwargs)
self.sigmas.append(sigma)
self.amplitudes.append(amplitude)
self.mus.append(mu)
self.fits.append(amplitude * scipy.stats.norm.pdf(self.X, mu,sigma))
self.sigma = mean(self.sigmas)
self.amplitude = mean(self.amplitudes)
self.mu = mean(self.mus)
pylab.plot(self.X, self.amplitude * scipy.stats.norm.pdf(self.X, self.mu, self.sigma),
**fit_kwargs)
if semilogy:
pylab.semilogy()
pylab.grid()
pylab.figure(2)
pylab.clf()
#pylab.bar(self.X, self.Y, width=0.85, ec="k", alpha=0.5)
M = mean(self.fits, axis=0)
S = pylab.std(self.fits, axis=0)
pylab.fill_between(self.X, M-3*S, M+3*S, color="gray", alpha=0.5)
pylab.fill_between(self.X, M-2*S, M+2*S, color="gray", alpha=0.5)
pylab.fill_between(self.X, M-S, M+S, color="gray", alpha=0.5)
#pylab.plot(self.X, M-S, color="k")
#pylab.plot(self.X, M+S, color="k")
pylab.plot(self.X, self.amplitude * scipy.stats.norm.pdf(self.X, self.mu, self.sigma),
**fit_kwargs)
pylab.grid()
return self.mu, self.sigma, self.amplitude