2016-08-17 40 views
2

我使用matplotlib繪製了一系列DATAS的和得到的結果如下如何在情節

enter image description here

創建非直線軸,但我期待有一個非直線軸如下。

enter image description here

我怎麼能做出那種陰謀?提前致謝。

+0

你能分享一下你寫的代碼嗎? – CoMartel

回答

5

您可以設置y軸通過寫plt.yscale('log')

完整的例子來logaritmic:

​​
+0

請參閱此處的文檔:http://matplotlib.org/users/pyplot_tutorial.html#logarithmic-and-other-nonlinear-axis – CoMartel

+0

它確實有效。謝謝! – highsun16

3

您可以使用plt.semilogy

import matplotlib.pyplot as plt 

plt.semilogy([i**2 for i in range(100)]) 
plt.show() 

結果:

enter image description here