#14690·matplotlib

DOC: 是否需要在图库中对子图示例进行一些清理?

作者: bingyao创建于 2019年7月4日更新于 2026年9月14日
标签Documentationstatus: inactive

建议 1: 后台信息 目前,Gallery 中有几个非常相似的子图示例:[多个子图][1]: - examples/subplots_axes_and_figures/subplot.py - 使用 pyplot 风格创建 2 个子图 - 此示例还出现在入门级的 [Pyplot 教程][4] 中并进行了解释。[基本子图示例][2]: - examples/subplots_axes_and_figures/subplot_demo.py - 与 多个子图 示例几乎相同,但使用 OOP 风格。[图标题][3]: - examples/subplots_axes_and_figures/figure_title.py - 基本子图示例 加上标题设置(OOP 风格)。 ### 清理建议 我们可以将这三个示例合并为一个使用 OOP 风格的示例,例如:带标题的子图,并在该示例中添加一个链接到 [Pyplot 教程][4],以便参考 pyplot 风格。 ## 建议 2: 后台信息 此外,在 Gallery 中还有一个[使用 plt.subplots 创建多个子图][5]: - examples/subplots_axes_and_figures/subplots_demo.py - 尽管文件名与 基本子图示例subplots_demo.pysubplot_demo.py)非常相似,但该示例实际上是对 plt.subplots 使用的轻松介绍。 ### 清理建议 我们可以将此文章从 Gallery 移至教程的入门级,作为 子图教程。由于中级教程中已存在 [GridSpec 指南][6] 和 [Tight Layout 指南][7],我认为这也可以平滑地过渡。 如果这些建议可接受,我愿意做这项工作 :) [1]: https://matplotlib.org/gallery/subplots_axes_and_figures/subplot.html [2]: https://matplotlib.org/gallery/subplots_axes_and_figures/subplot_demo.html [3]: https://matplotlib.org/gallery/subplots_axes_and_figures/figure_title.html [4]: https://matplotlib.org/tutorials/introductory/pyplot.html#working-with-multiple-figures-and-axes [5]: https://matplotlib.org/gallery/subplots_axes_and_figures/subplots_demo.html [6]: https://matplotlib.org/tutorials/intermediate/gridspec.html#sphx-glr-tutorials-intermediate-gridspec-py [7]: https://matplotlib.org/tutorials/intermediate/tight_layout_guide.html#sphx-glr-tutorials-intermediate-tight-layout-guide-py

内容来源: matplotlib/matplotlib