In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to realize the Matplotlib 3D map of Python data analysis". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to realize the Matplotlib 3D map of Python data analysis".
Matplotlib provides a mpl_toolkits.mplot3d toolkit to draw 3D charts. We import it and use it as follows:
From mpl_toolkits import mplot3d
After importing through the above code, you can pass the parameter projection='3d' to the specified chart object and set its type to 3D, as follows:
Import matplotlib.pyplot as pltfrom mpl_toolkits import mplot3dfig = plt.figure () # create a sub-graph object of type 3dax = fig.add_subplot (projection='3d') ax.set_xlabel ('Xpicture, color='r') ax.set_ylabel (' Yee, corlor='g') ax.set_zlabel ('Zero, corlor='b')
In the above sample code, we create a subgraph object, set its type to 3D type, and set the label and label color of the axis.
The output is as follows:
As you can see, a three-dimensional axis is generated, and let's add a chart to this three-dimensional axis:
Import numpy as npz = np.linspace (0,45,100) x = z * np.sin (z) y = z * np.cos (z) ax.plot3D (x, y, z,'# 800080') plt.show ()
The output is as follows:
Among them, plot3D () method can draw 3D line chart, in addition, there are scatter3D () drawing 3D scatter chart, bar3D () drawing 3D bar chart and so on. These methods are basically consistent with the corresponding 2D graphics method.
Thank you for your reading, the above is the content of "how to realize the Matplotlib 3D map of Python data analysis". After the study of this article, I believe you have a deeper understanding of how to realize the Matplotlib 3D map of Python data analysis, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.