本文整理汇总了Python中pylab.fill_between方法的典型用法代码示例。如果您正苦于以下问题:Python pylab.fill_between方法的具体用法?Python pylab.fill_between怎么用?Python pylab.fill_between使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylab
的用法示例。
在下文中一共展示了pylab.fill_between方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot_stats
# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import fill_between [as 别名]
def plot_stats(x=None, y=None, label=None, color='navy'):
"""plot_stats."""
y = np.array(y)
y0 = y[0]
y1 = y[1]
y2 = y[2]
y3 = y[3]
y4 = y[4]
plt.fill_between(x, y3, y4, color=color, alpha=0.08)
plt.fill_between(x, y1, y2, color=color, alpha=0.08)
plt.plot(x, y0, '-', lw=2, color=color, label=label)
plt.plot(x, y0,
linestyle='None',
markerfacecolor='white',
markeredgecolor=color,
marker='o',
markeredgewidth=2,
markersize=8)
示例2: addqqplotinfo
# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import fill_between [as 别名]
def addqqplotinfo(qnull,M,xl='-log10(P) observed',yl='-log10(P) expected',xlim=None,ylim=None,alphalevel=0.05,legendlist=None,fixaxes=False):
distr='log10'
pl.plot([0,qnull.max()], [0,qnull.max()],'k')
pl.ylabel(xl)
pl.xlabel(yl)
if xlim is not None:
pl.xlim(xlim)
if ylim is not None:
pl.ylim(ylim)
if alphalevel is not None:
if distr == 'log10':
betaUp, betaDown, theoreticalPvals = _qqplot_bar(M=M,alphalevel=alphalevel,distr=distr)
lower = -sp.log10(theoreticalPvals-betaDown)
upper = -sp.log10(theoreticalPvals+betaUp)
pl.fill_between(-sp.log10(theoreticalPvals),lower,upper,color="grey",alpha=0.5)
#pl.plot(-sp.log10(theoreticalPvals),lower,'g-.')
#pl.plot(-sp.log10(theoreticalPvals),upper,'g-.')
if legendlist is not None:
leg = pl.legend(legendlist, loc=4, numpoints=1)
# set the markersize for the legend
for lo in leg.legendHandles:
lo.set_markersize(10)
if fixaxes:
fix_axes()
示例3: plot_facade_cuts
# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import fill_between [as 别名]
def plot_facade_cuts(self):
facade_sig = self.facade_edge_scores.sum(0)
facade_cuts = find_facade_cuts(facade_sig, dilation_amount=self.facade_merge_amount)
mu = np.mean(facade_sig)
sigma = np.std(facade_sig)
w = self.rectified.shape[1]
pad=10
gs1 = pl.GridSpec(5, 5)
gs1.update(wspace=0.5, hspace=0.0) # set the spacing between axes.
pl.subplot(gs1[:3, :])
pl.imshow(self.rectified)
pl.vlines(facade_cuts, *pl.ylim(), lw=2, color='black')
pl.axis('off')
pl.xlim(-pad, w+pad)
pl.subplot(gs1[3:, :], sharex=pl.gca())
pl.fill_between(np.arange(w), 0, facade_sig, lw=0, color='red')
pl.fill_between(np.arange(w), 0, np.clip(facade_sig, 0, mu+sigma), color='blue')
pl.plot(np.arange(w), facade_sig, color='blue')
pl.vlines(facade_cuts, facade_sig[facade_cuts], pl.xlim()[1], lw=2, color='black')
pl.scatter(facade_cuts, facade_sig[facade_cuts])
pl.axis('off')
pl.hlines(mu, 0, w, linestyle='dashed', color='black')
pl.text(0, mu, '$\mu$ ', ha='right')
pl.hlines(mu + sigma, 0, w, linestyle='dashed', color='gray',)
pl.text(0, mu + sigma, '$\mu+\sigma$ ', ha='right')
pl.xlim(-pad, w+pad)
示例4: fit
# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import fill_between [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