Most people don't spend a lot of time learning the Matplotlib library, and still can implement the drawing needs, because there are already people on the open-source platform such as StackOverflow, GitHub to provide the majority of drawing problem solutions. We usually use Google to complete our drawing needs. At least that's what I am.
Matlibplot provides a variety of drawing UIs that can be categorized as follows:
Popup window and interactive interface:%matplotlib Qt and%matplot tk
Non-interactive inline drawing:%matplotlib inline
Interactive inline drawing:%matplotlib notebook--> Don't use this, it will make the switch difficult.
2. Understanding the Matplotlib object structure
Pyplot is a Matplotlib object-oriented function interface.
PLT.GCA ()
It returns the axis associated with the current plot ()
If you do not use Plt.close (), an empty graphic is displayed. Because the inline command was used at the beginning.
AXIS_ID is still the same, but when we move to another Notebook block, PLT.GCA () changes.
When we use axes[i], we can call any axes object in any previous code block, but calling Plt.bla () creates a new axes object in each code block and only calls the current object. Therefore, in the example above, the new Plt object is created only when Plt.title () is called.
Important observation: We usually call Plt.bla () on the current Axis object, which makes the axis objects in each code block newly created. But by calling Fig.axes[0], we can also process the previous axes object from any block of code.
From: https://matplotlib.org/faq/usage_faq.html
4. Basic examples of drawing
A basic example of how to draw, covering all aspects of object-oriented drawing. Please read it carefully.
Summarize the above example:
The idea is to consider the above graphic as a 2x4 grid. Then assign multiple grids to a single graph to accommodate the desired graphics.
Focus:
We can use Subplot2grid to customize our drawing layout.
We can use Plt.figure () to create a graphic with no axes object and then manually add the Axes object.
We can use Fig.suptitle () to set the overall caption of the entire graph.
7. Line style and line width
Change the line width, color, or style.
8. Basic Data distribution
The necessary operations in the EDA process.
9. Contour and color grid for two-D arrays
Thermal image (color grid) and contour plots help visualize 2D data in many cases.
10. Image adjustment, modification of edge coordinates and scale
Finally, adjust the details to make the drawing look better.
11. Scale limits and automatic adjustment
13. Axis
14. End
Blog site: Https://www.kaggle.com/grroverpr/matplotlib-plotting-guide/notebook
You are also welcome to pay attention to my blog or public number OH: Https://home.cnblogs.com/u/Python1234/Python Learning Communication
Welcome to my thousand-person conversation group: 125240963
Python matplotlib drawing Usage Guide! The cheats have been imparted to you!