本文整理匯總了Python中pylab.loglog方法的典型用法代碼示例。如果您正苦於以下問題:Python pylab.loglog方法的具體用法?Python pylab.loglog怎麽用?Python pylab.loglog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pylab
的用法示例。
在下文中一共展示了pylab.loglog方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: plot_question3
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import loglog [as 別名]
def plot_question3():
'''
graph of total resources generated as a function of time;
for upgrade_cost_increment == 0
'''
data = resources_vs_time(0.0, 100)
time = [item[0] for item in data]
resource = [item[1] for item in data]
# plot in pylab on logarithmic scale (total resources over time for upgrade growth 0.0)
pylab.loglog(time, resource)
pylab.title('Silly Homework')
pylab.legend('0.0')
pylab.xlabel('Current Time')
pylab.ylabel('Total Resources Generated')
pylab.show()
#plot_question3()
# Question 4
示例2: plot_question7
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import loglog [as 別名]
def plot_question7():
'''
graph of total resources generated as a function of time,
for upgrade_cost_increment == 1
'''
data = resources_vs_time(1.0, 50)
time = [item[0] for item in data]
resource = [item[1] for item in data]
a, b, c = pylab.polyfit(time, resource, 2)
print 'polyfit with argument \'2\' fits the data, thus the degree of the polynomial is 2 (quadratic)'
# plot in pylab on logarithmic scale (total resources over time for upgrade growth 0.0)
#pylab.loglog(time, resource, 'o')
# plot fitting function
yp = pylab.polyval([a, b, c], time)
pylab.plot(time, yp)
pylab.scatter(time, resource)
pylab.title('Silly Homework, Question 7')
pylab.legend(('Resources for increment 1', 'Fitting function' + ', slope: ' + str(a)))
pylab.xlabel('Current Time')
pylab.ylabel('Total Resources Generated')
pylab.grid()
pylab.show()
示例3: test_distance_scaling
# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import loglog [as 別名]
def test_distance_scaling(self):
#""" Check that the waveform is consistent under distance changes
#"""
distance = 1e6
tolerance = 1e-5
fac = 10
hpc, hcc = get_waveform(self.p, distance=distance)
hpm, hcm = get_waveform(self.p, distance=distance*fac)
hpf, hcf = get_waveform(self.p, distance=distance*fac*fac)
hpn, hcn = get_waveform(self.p, distance=distance/fac)
f = pylab.figure()
pylab.axes([.1, .2, 0.8, 0.70])
htilde = make_frequency_series(hpc)
pylab.loglog(htilde.sample_frequencies, abs(htilde), label="D")
htilde = make_frequency_series(hpm)
pylab.loglog(htilde.sample_frequencies, abs(htilde), label="D * %s" %fac)
htilde = make_frequency_series(hpf)
pylab.loglog(htilde.sample_frequencies, abs(htilde), label="D * %s" %(fac*fac))
htilde = make_frequency_series(hpn)
pylab.loglog(htilde.sample_frequencies, abs(htilde), label="D / %s" %fac)
pylab.title("Vary %s distance, $\\tilde{h}$+" % self.p.approximant)
pylab.xlabel("GW Frequency (Hz)")
pylab.ylabel("GW Strain")
pylab.legend()
pylab.xlim(xmin=self.p.f_lower)
info = self.version_txt
pylab.figtext(0.05, .05, info)
if self.save_plots:
pname = self.plot_dir + "/%s-distance-scaling.png" % self.p.approximant
pylab.savefig(pname)
if self.show_plots:
pylab.show()
else:
pylab.close(f)
self.assertTrue(hpc.almost_equal_elem(hpm * fac, tolerance, relative=True))
self.assertTrue(hpc.almost_equal_elem(hpf * fac * fac, tolerance, relative=True))
self.assertTrue(hpc.almost_equal_elem(hpn / fac, tolerance, relative=True))