Symlog演示

示例使用symlog(对称对数)轴缩放。

Symlog演示

  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. dt = 0.01
  4. x = np.arange(-50.0, 50.0, dt)
  5. y = np.arange(0, 100.0, dt)
  6. plt.subplot(311)
  7. plt.plot(x, y)
  8. plt.xscale('symlog')
  9. plt.ylabel('symlogx')
  10. plt.grid(True)
  11. plt.gca().xaxis.grid(True, which='minor') # minor grid on too
  12. plt.subplot(312)
  13. plt.plot(y, x)
  14. plt.yscale('symlog')
  15. plt.ylabel('symlogy')
  16. plt.subplot(313)
  17. plt.plot(x, np.sin(x / 3.0))
  18. plt.xscale('symlog')
  19. plt.yscale('symlog', linthreshy=0.015)
  20. plt.grid(True)
  21. plt.ylabel('symlog both')
  22. plt.tight_layout()
  23. plt.show()

下载这个示例