In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to draw 3D flowers with Python". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to draw 3D flowers with Python.
Dynamic display
This is a dynamic graph.
Guide reading
Brothers can collect it! You can give it away on Valentine's Day. Feixue found some flowers written by python to be encapsulated and given to everyone. Not so cool, but with enough heart. Don't forget to like it. I won't go into details. Come on, show it!
Source code and detailed explanation of Lotus def lotus (): fig = plt.figure (figsize= (10L7), facecolor='black',clear=True) ax = fig.gca (projection='3d') [x, t] = np.meshgrid (np.array (range (25)) / 24.0, np.arange (0, 575.5) 575 * 17 * np.pi-2*np.pi) p = (np.pi/2) * np.exp (- t / (8*np.pi)) u = 1-(1-np.mod (3.6%) 2*np.pi) / np.pi) * * 4Accord 2 y = 2 * (xanthates 2y*np.sin x) * * 2*np.sin (p) r = u * (x*np.sin (p) + y*np.cos (p)) surf = ax.plot_surface (r*np.cos (t), r*np.sin (t), u * (x*np.cos (p)-y*np.sin (p)), rstride=1, cstride=1, cmap=cm.gist_rainbow_r Linewidth=0, antialiased=True)
Effect picture
Rose def rose_flower (): fig = plt.figure (figsize= (10P7), facecolor='black',clear=True) ax = fig.gca (projection='3d') # shifts the phase backward 6*pi [x, t] = np.meshgrid (np.array (range (25)) / 24.0, np.arange (0, 575.5) ) / 575 * 20 * np.pi + 4*np.pi) p = (np.pi / 2) * np.exp (- t / (8 * np.pi)) # add edge disturbance change = np.sin (15 * t) / 150 # to reduce the parameters of t Enlarge the angle of petals u = 1-(1-np.mod (3.3t) 2 * np.pi) / np.pi) * * 4 / 2 + change y = 2 * (x * 2-x) * 2 * np.sin (p) r = u * (x * np.sin (p) + y * np.cos (p)) h = u * (x * np.cos (p)-y * np.sin (p)) c = cm.get_cmap ('Reds') surf = ax.plot_surface (r * np.cos (t)) R * np.sin (t), h, rstride=1, cstride=1, cmap= c, linewidth=0, antialiased=True)
Effect picture
Peach blossom def peach_blossom (): fig = plt.figure (figsize= (10) 7), facecolor='black',clear=True) ax = fig.gca (projection='3d') [x, t] = np.meshgrid (np.array (range (25)) / 24.0, np.arange (0, 575.5) 575 * 6 * np.pi-4*np.pi) p = (np.pi / 2) * np.exp (- t / (8 * np.pi)) change = np.sin (10 * t) / 20 u = 1-(1-np.mod (5.2 * t) 2 * np.pi) / np.pi) * * 4 / 2 + change y = 2 * (x * 2-x) * 2 * np.sin (p) r = u * (x * np.sin (p) + y * np.cos (p)) * 1.5h = u * (x * np.cos (p)-y * np.sin (p)) c = cm.get_cmap ('spring_r') surf = ax.plot_surface (r * np.cos (t) R * np.sin (t), h, rstride=1, cstride=1, cmap= c, linewidth=0, antialiased=True)
Effect picture
Rose def monthly_rose (): fig = plt.figure (figsize= (10P7), facecolor='black',clear=True) ax = fig.gca (projection='3d') [x, t] = np.meshgrid (np.array (range (25)) / 24.0, np.arange (0, 575.5) 575 * 30 * np.pi-4 * np.pi) p = (np.pi / 2) * np.exp (- t / (8 * np.pi)) change = np.sin (20 * t) / 50 u = 1-(1-np.mod (3.3 * t) 2 * np.pi) / np.pi) * * 4 / 2 + change y = 2 * (x * 2-x) * 2 * np.sin (p) r = u * (x * np.sin (p) + y * np.cos (p)) * 1.5h = u * (x * np.cos (p)-y * np.sin (p)) c = cm.get_cmap ('magma') surf = Ax.plot_surface (r * np.cos (t)) R * np.sin (t), h, rstride=1, cstride=1, cmap=c, linewidth=0, antialiased=True)
Effect picture
At this point, I believe you have a deeper understanding of "how to draw 3D flowers with Python". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.