In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you how to draw 3D graphics in python Axes3D. I hope you will get something after reading this article. Let's discuss it together.
Description
1. Axes3D, a function for drawing 3D coordinates.
Create a drawing object and use this drawing object to create an Axes object.
2. X axis-2 to 2, Y axis-2 to 2.
Draw the lattice on the plane with the points on the two axes, the square sum of X and Y and the root sign.
3. Calculate the sin function and assign it to Z coordinate.
Specific function methods can be viewed with help (function).
4. Indicate the three axes.
Example
#-*-coding: utf-8-*-# By:Eastmount CSDNfrom matplotlib import pyplot as pltimport numpy as npfrom mpl_toolkits.mplot3d import Axes3D # function for drawing 3D coordinates fig = plt.figure () # create a drawing object ax = Axes3D (fig) # create an Axes object X = np.arange (- 2,2) with this drawing object Y = np.arange (- 2,2,0.25) # Y axis-2 to 2 print (Y) X, Y = np.meshgrid (X) Y) # use points on two axes to draw the lattice R = np.sqrt (X-axis 2 + Y-axis 2) # the sum of squares of X and Y, the open root sign Z = np.sin (R) # calculate the sin function assignment to the Z coordinate # the specific function method can be viewed by help (function) For example: help (ax.plot_surface) ax.plot_surface (X, Y, Z, rstride=1, cstride=1, cmap='rainbow') # Mark the three axes ax.set_xlabel ('xlabel', color='r') ax.set_ylabel ('ylabel', color='g') ax.set_zlabel ('zlabel', color='b') plt.show () after reading this article, I believe you have some understanding of "how python Axes3D draws 3D graphics" If you want to know more related knowledge, welcome to follow the industry information channel, thank you for reading!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.