Matplotlib:图表的基本构成及部件
2018-08-04 本文已影响20人
ACphart
As shown below:
Glossary of objects in a Matplotlib figure
Figure:
- A figure is the whole plotting area that contains all plot elements. Multiple subplots may be tiled in grid within one figure.
Subplot:
- A subplot is a subregion in a figure that contains all of the relevant data to be displayed on the same axes.
Axis:
- An axis measures the value of a point at a certain position. Most plots contain two axes, x (horizontal) and y (vertical). Sometimes, multiple axes, each containing one data series, can be overlaid in the same plotting area of a 2D plot. You can also plot a 3D graph using a Matplotlib toolkit package, where the z axis will be specified.
Axes:
- In Matplotlib, the keyword in plural, axes, refers to the combination of axes in a plot. This can be intuitively understood as the data plotting area, as shown in the preceding figure.
Tip: Be careful not to confuse axes and axis. While we usually refer to lines where ticks lie on as "axes," in Matplotlib, the plural axes and the singular axis specifically refer to the plotting area and the lines, respectively.
Spine:
- Spines are the four lines that denote the boundaries of the data area.
Grid:
- Grids are lines inside the data area that aid the reading of values.
Title:
- A name of the figure that describes the figure clearly and succinctly.
Axis labels:
- A word description of each axis. Units should be given if applicable.
Ticks:
- Ticks are marks of division on a plot axis. We can add major ticks and minor ticks to a figure.
Tick labels:
- Both major and minor ticks can be labeled. Besides printing the input data values directly, there are also formatters specific for date, logarithmic scale, and so on. We can also use our own defined functions to format the labels.
Legend:
- A legend has labels of each data series. It usually appears as a box that matches the styles of a data series with the corresponding names.
Patches(Shapes):
- Different shapes can be added by matplotlib.patches, including rectangles, circles, ellipses, rings, sectors, arrows, wedges, and polygons.