如何在 python 的 matplotlib 中以对数显示垂直
how to show the vertical in logarithmic in matplotlib of python
如何在matplotlib中以对数形式显示垂直于python。
例如,y 是 1,10,100,1000 而不是 1,2,3,....
我需要这个,因为我想展示一些比较,其中一个太大了,例如其中一个达到了 200 的最大值,而另外两个达到了最大值 3.5。我需要清楚地显示两个低点的区别,我也应该在同一个图中显示第三个!
如果您使用 ax
:
import matplotlib.pyplot as plt
x=[1,2,3,4,5,6]
y=[2,14,56,170,600,1100]
fig, ax = plt.subplots()
ax.plot(x,y)
ax.set_yscale('log')
或者如果您使用 plt
:
plt.plot(x,y)
plt.yscale('log')
plt.show()
如何在matplotlib中以对数形式显示垂直于python。
例如,y 是 1,10,100,1000 而不是 1,2,3,....
我需要这个,因为我想展示一些比较,其中一个太大了,例如其中一个达到了 200 的最大值,而另外两个达到了最大值 3.5。我需要清楚地显示两个低点的区别,我也应该在同一个图中显示第三个!
如果您使用 ax
:
import matplotlib.pyplot as plt
x=[1,2,3,4,5,6]
y=[2,14,56,170,600,1100]
fig, ax = plt.subplots()
ax.plot(x,y)
ax.set_yscale('log')
或者如果您使用 plt
:
plt.plot(x,y)
plt.yscale('log')
plt.show()