Python + matplotlib implement filling spiral instance, pythonmatplotlib
Filling spiral Demonstration Result:
Instance code:
Import matplotlib. pyplot as pltimport numpy as nptheta = np. arange (0, 8 * np. pi, 0.1) a = 1b =. 2for dt in np. arange (0, 2 * np. pi, np. pi/2.0): x = a * np. cos (theta + dt) * np. exp (B * theta) y = a * np. sin (theta + dt) * np. exp (B * theta) dt = dt + np. pi/4.0x2 = a * np. cos (theta + dt) * np. exp (B * theta) y2 = a * np. sin (theta + dt) * np. exp (B * theta) xf = np. concatenate (x, x2 [:-1]) yf = np. concatenate (y, y2 [:-1]) p1 = plt. fill (xf, yf) plt. show ()
Summary
The above is all the content about how Python + matplotlib achieves filling spiral instances. I hope it will be helpful to you. If you are interested, you can continue to refer to other related topics on this site. If you have any shortcomings, please leave a message. Thank you for your support!