在下面的图中,X范围非常宽,并且在1 MeV到0.1 MeV附近的图形的形状被抑制。
我想要一幅图,其中X标度在10,1,0.1 MeV之间有相等的分离(或相等的网格)。

发布于 2016-01-29 09:56:39
您可以使用matplotlib的semilogx函数而不是plot来使x轴成对数。
下面是一个简短的例子:
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0.01,14,0.01)
y = np.log(100*x)
fig,(ax1,ax2) = plt.subplots(2)
ax1.plot(x,y)
ax1.set_xlim(x[-1],x[0])
ax1.set_title('plot')
ax2.semilogx(x,y)
ax2.set_xlim(x[-1],x[0])
ax2.set_title('semilogx')
plt.show()

发布于 2016-01-29 10:58:06
还可以考虑ax.set_xscale("log") loglog.html
https://stackoverflow.com/questions/35079291
复制相似问题