我试图生成一个值列表,然后使用MatPlotLib Hist函数绘制这些值列表。这就是我的图形:https://i.stack.imgur.com/u7P8Q.png
对于另外两个图形,我完全遵循了这一过程,因为某种原因,这给我带来了麻烦。
这是我的代码:
for y in range(Nloop):
e0_y = e_List[y] # Takes the a value from these list and sets it equal to this variable
a0_y = a_List[y] # Same thing ^^^
Term_1 = (a0_y ** 4)/((m_tot**3)*eta)
Term_2 = (1 - e0_y**2)**(7/2)
Unit_Conversions = (c**5/G**3)
tau = (3/85) * Term_1 * Term_2 * Unit_Conversions
T_List[y] = tau
MIN, MAX = 1, 1e12
Nbins = 25
bins = 10 ** np.linspace(np.log10(MIN), np.log10(MAX), Nbins)
plt.hist(T_List, bins=25, histtype='step')
plt.xscale('log') # x-axis now has a log-scale
plt.yscale('log')
plt.title('Distribution')
plt.xlabel('T [sec]')
plt.ylabel('Frequency')
plt.show()