In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces what is the use of Matplotlib in Python. It is very detailed and has a certain reference value. Interested friends must finish reading it!
Preface
Matplotlib is the most popular drawing library in Python, which is mainly used for 2D drawing and 3D drawing.
1. Installation of Matplotlib
You can install it by executing the following statement in cmd:
Pip install matplotlib
If you are using an integrated development environment, such as pycharm, it comes with it and can be used directly.
2. Testing
Matplotlib.pyplot is a collection of command-style functions that can be drawn by calling related functions, such as the simplest one, as shown below:
The above three lines of code complete the drawing of a simple line chart. Where the range of the x-axis is 1: 4 and the range of the y-axis is 100: 460.
The code is copied as follows:
Import matplotlib.pyplot as pltplt.plot ([1,2,3,4], [100,250,300,460]) plt.show ()
On the first line, introduce the matplotlib.pyplot package and simplify it to plt. It's an agreement, and almost everyone does it.
On the second line, call plt's function plot to draw the graph, which determines whether it is a straight line or a broken line according to the parameters in ().
The third line calls the show () function to display the graph.
Among them, the plot () function takes many parameters, including x-axis range, y-axis range, legend, coordinate axis, title, and so on.
The above is all the content of this article "what is the use of Matplotlib in Python?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.