本文整理汇总了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))