填充螺旋

填充螺旋示例

  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. theta = np.arange(0, 8*np.pi, 0.1)
  4. a = 1
  5. b = .2
  6. for dt in np.arange(0, 2*np.pi, np.pi/2.0):
  7. x = a*np.cos(theta + dt)*np.exp(b*theta)
  8. y = a*np.sin(theta + dt)*np.exp(b*theta)
  9. dt = dt + np.pi/4.0
  10. x2 = a*np.cos(theta + dt)*np.exp(b*theta)
  11. y2 = a*np.sin(theta + dt)*np.exp(b*theta)
  12. xf = np.concatenate((x, x2[::-1]))
  13. yf = np.concatenate((y, y2[::-1]))
  14. p1 = plt.fill(xf, yf)
  15. plt.show()

下载这个示例