Skip to content

Commit d454304

Browse files
committed
docs: update documentation for plotfig usage
Updated the Chinese and English documentation for the single_group.md file with: - Corrected section heading from '多子图' to '多坐标系' - Improved clarity and consistency in explanations - Fixed formatting issues in code blocks and markdown structure - Updated example content to reflect current API usage - Maintained consistent terminology across both language versions
1 parent f38d118 commit d454304

3 files changed

Lines changed: 889 additions & 815 deletions

File tree

‎docs/en/index.md‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,45 @@ The project adopts a modular design, containing the following main functional mo
2424

2525
---
2626

27+
## Core Three Elements of Matplotlib: Figure, Axes, and Subplot
28+
2729
Fun fact: All elements of a figure[^1].
30+
2831
![Parts of a Figure](https://matplotlib.org/stable/_images/anatomy.png)
2932

33+
When using Matplotlib to create plots, Figure, Axes, and Subplot are the three most fundamental and essential concepts.
34+
Understanding the relationship among them is key to mastering Matplotlib's underlying logic.
35+
36+
### Figure (Canvas / Graphic Window)
37+
38+
A Figure is the top‑level container for the entire plotting.
39+
You can think of it as a blank canvas or the graphic window that appears on your screen.
40+
The Figure holds all plotting elements.
41+
42+
You can set global properties on it, such as the overall size (figsize), background color, resolution (dpi), etc.
43+
44+
### Axes (Coordinate System / Plotting Area)
45+
46+
Axes are the actual “plotting area” in Matplotlib, and where most of the data manipulation and drawing happens.
47+
An Axes is a rectangular region equipped with a data coordinate system.
48+
It includes not only the graphical elements you draw (lines, scatter points, bars, etc.) but also all auxiliary components such as the X‑axis, Y‑axis, tick labels, axis labels, titles, and more.
49+
50+
A single Figure can contain multiple Axes objects.
51+
These Axes can be arranged in a regular grid, or they can be placed freely anywhere on the canvas, independent of any grid.
52+
53+
### Subplot (Sub‑plot / Grid Partition)
54+
55+
A Subplot is a special term for an Axes that is placed in a regular grid.
56+
When you want to display multiple charts neatly on one canvas (for example, a vertical comparison or a 2×2 layout), you divide the canvas into a regular grid.
57+
Each grid cell then contains an Axes, and that Axes is called a Subplot.
58+
59+
In essence, a Subplot is exactly the same as an Axes.
60+
They share the same properties and methods (both can be used for plotting and for setting axis properties).
61+
The only difference is that Subplots are created in batch using the subplots() function, which arranges them in a predefined grid.
62+
63+
!!! info
64+
Subplot: specifically refers to an Axes that is generated via subplots() or add_subplot() within a regular grid.
65+
66+
Axes: a broader concept. It includes not only grid‑based subplots, but also axes placed arbitrarily on the canvas using `add_axes([left, bottom, width, height])`, as well as embedded inset axes (Inset Axes) nested inside a main plot.
67+
3068
[^1]: [Quick start guide of matplotlib.](https://matplotlib.org/stable/tutorials/introductory/usage.html#parts-of-a-figure)

‎docs/zh/index.md‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,43 @@
2424

2525
---
2626

27+
## Matplotlib 核心三要素:Figure、Axes 与 Subplot
28+
2729
烫知识:一张图上的所有元素[^1]。
30+
2831
![Parts of a Figure](https://matplotlib.org/stable/_images/anatomy.png)
2932

33+
在使用 Matplotlib 绘图时,Figure(画布)、Axes(坐标系) 和 Subplot(子图) 是三个最基础、最核心的概念。
34+
35+
### Figure(画布/图形窗口)
36+
37+
Figure 是整个绘图的最顶层容器。
38+
你可以把它理解为一张空白的画布,或者是电脑屏幕上弹出的那个图形窗口。
39+
Figure 承载着所有绘图元素。
40+
你可以在它上面设置整张图的尺寸(figsize)、背景颜色、分辨率(dpi)等全局属性。
41+
42+
### Axes(坐标系/绘图区)
43+
44+
Axes 是 Matplotlib 中真正的“画图区域”,也是绝大多数数据处理操作的发生地。
45+
Axes 是一个带有数据坐标系统的矩形区域。
46+
它不仅包含你绘制的折线、散点、柱状图等图形,还包含了 X 轴、Y 轴、刻度标签、轴标签、标题等所有辅助元素。
47+
48+
一个 Figure(画布)上可以包含多个 Axes(坐标系)。
49+
这些坐标系可以按网格整齐排列,也可以脱离网格、在画布上任意浮动。
50+
51+
### Subplot(子图/网格分区)
52+
53+
Subplot 是 Axes(坐标系)在网格排列下的一种特殊称呼。
54+
当你想在一张画布上整齐地展示多张图表时(比如上下对比,或 2x2 的四方格),就需要将画布划分为规则的网格。
55+
划分后,每一个格子里的坐标系,就叫做 Subplot(子图)。
56+
57+
Subplot 本质上就是一个 Axes。
58+
它们具有完全相同的属性和方法(都可以画图、设置坐标轴)。
59+
唯一的不同在于,Subplot 是通过 `subplots()` 函数在预设网格中批量生成的。
60+
61+
!!! info
62+
Subplot(子图):专指通过 subplots() 或 add_subplot() 在规则网格中生成的 Axes。
63+
64+
Axes(坐标系):是更广义的概念。它不仅包含网格里的子图,还包含通过 `add_axes([left, bottom, width, height])` 方法在画布上任意位置浮动的坐标系,也包含嵌入在主图中的嵌套小图(Inset Axes)。
65+
3066
[^1]: [Quick start guide of matplotlib.](https://matplotlib.org/stable/tutorials/introductory/usage.html#parts-of-a-figure)

0 commit comments

Comments
 (0)