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 will explain in detail how to achieve functional drawing in Matplotlib. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
A brief introduction to 0Jet Matplotlib
Matplotlib is the most famous library for data visualization in Python data analysis, and its drawing method is very similar to that in matlab.
There are usually two different ways to draw with Matplotlib: object-oriented drawing and functional drawing. In addition, you can also draw quickly with the plot function of dataframe. Their characteristics are as follows.
1. Object-oriented drawing Scheme (ax.plot) has clear structure, complete functions and easy to understand. [recommended]
2. The functional drawing scheme (plt.plot) code is relatively short, but it is easy to lose the operating object and cause confusion.
3Jing dataframe rapid drawing scheme (df.plot) can link up the data analysis and visualization process well. [highly recommended]
The functional drawing scheme is summarized as follows.
The functional drawing scheme is very similar to the style of matlab drawing.
When you complete a simple drawing task, the code is short.
When the drawing task is more complex, it is easy to get lost and need to switch to the object-oriented style.
First, functional drawing demonstration
Second, color, linetype and marking
1, control color
The correspondence between colors is
B---blue c---cyan g---green k----black
M---magenta r---red w---white y----yellow
There are four ways to represent colors
(1) use English full name or abbreviation such as: purple
(2) use hexadecimal such as # FF00FF
(3) use RGB or RGBA tuples.
(4) Grayscale intensity such as' 0.7'
(note, An in RGBA represents Alpha channel, which controls transparency.)
Several recommended drawing colors are: red, green and blue (rbg), c---cyan (cyan)
M---magenta (magenta). Set transparency if necessary.
2, control linetype
The corresponding relationship between symbols and linetypes is
-solid line
-- short term
-. Short point interphase line
Dotted line
3. Control tag style
On "Matplotlib how to achieve functional drawing" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.
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.