当前位置:网站首页>How to learn to understand Matplotlib instead of simple code reuse

How to learn to understand Matplotlib instead of simple code reuse

2022-06-13 02:17:00 Cloud edge flying elephant

Study first matplotlib Architecture of

First post the answers I think , Expert detour

Here is learning matplotlib The lesson of vegetable chicken

The following is a reprint

Container layer : Mainly by Canvas、Figure、Axes form .
      Canvas It is the system layer at the bottom , Act as a Sketchpad in the process of drawing , That is, place the canvas (Figure) Tools for .
      Figure yes Canvas The first floor above , It is also the first layer of the application layer that needs users to operate , Act as a canvas in the process of drawing .
      Axes It is the second layer of the application layer , In the process of drawing, it is equivalent to the role of the drawing area on the canvas .
     Figure: Refers to the entire graph ( Can pass plt.figure() Set the size and resolution of the canvas )
             Axes( Coordinate system ): The drawing area of the data
            Axis( Axis ): An axis in the coordinate system , Contains size limits 、 Scales and scale labels
      Be careful : 
             One figure( canvas ) It can contain more than one axes( Coordinate system / Drawing area ), But one axes It can only belong to one figure.
             One axes( Coordinate system / Drawing area ) It can contain more than one axis( Axis ), Including two is 2d Coordinate system ,3 One is 3d Coordinate system .
Auxiliary display layer
        The auxiliary display layer is Axes( Drawing area ) In addition to the image drawn according to the data , It mainly includes Axes appearance (facecolor)、 Border line (spines)、 Axis (axis)、 Axis name (axis label)、 Coordinate scale (tick)、 Axis scale label (tick label)、 Gridlines (grid)、 legend (legend)、 title (title) The content such as .
The setting of this layer can make the image display more intuitive and easier to be understood by users , But it will not have a substantial impact on the image .

Image layer
        Image layer refers to Axes Pass inside plot、scatter、bar、histogram、pie The image drawn by the equal function according to the data .

summary
      Canvas( Drawing board ) At the bottom , Users generally do not have access to
      Figure( canvas ) Based on the Canvas above
      Axes( Drawing area ) Based on the Figure above
       Axis (axis)、 legend (legend) The auxiliary display layer and image layer are built on Axes above
 
————————————————
Copyright notice : This paper is about CSDN Blogger 「xiaoyaGrace」 The original article of , follow CC 4.0 BY-SA Copyright agreement , For reprint, please attach the original source link and this statement .
Link to the original text :https://blog.csdn.net/xiaoyaGrace/article/details/103627128

The following is my understanding

Some common plt.plot()、plt.bar()、plt.pie() And so on axes Class method , So I just learned matplotlib It is recommended to know which classes there are , What are these classes for , What are the methods

Instead of going there at first plt.plot() Draw some line charts , Take a look at the architecture , Later, I will gradually understand in detail what some parameters do , I think it is helpful to master and skillfully use this tool

 

 

 

原网站

版权声明
本文为[Cloud edge flying elephant]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280543574309.html