matplotlib的两种样式是什么?

问题描述 投票:0回答:2

我正在读取matplotlib的documentation。在“编码样式”部分下,它表示:

查看本文档和示例时,您会发现不同的编码样式和使用模式。

稍后...

在不同的样式中,有两种被正式支持。因此,这些是使用matplotlib的首选方法。

用于pyplot样式...

但是在本节的其余部分中,他们从不明确解释或提及“第二”支持的编码样式。他们说了一些关于“ MATLAB样式”的内容,但是从上下文中还不清楚这是指pyplot样式(就像MATLAB一样)还是它本身是单独的样式。

问题

第二种受支持的matplotlib编码样式是什么,它与pyplot样式有什么关联/不同?

python matplotlib
2个回答
1
投票

可以理解,当前使用指南的这一部分有点难以理解。但是,最近有一个更新(#14223),这可能会使它更清晰。的预览版本可以在这里找到:

https://matplotlib.org/devdocs/tutorials/introductory/usage.html#the-object-oriented-interface-and-the-pyplot-interface

如上所述,本质上有两种使用Matplotlib的方法:

  • 明确创建图形和轴,并在其上调用方法(“面向对象(OO)样式”)。
  • 依靠pyplot来自动创建和管理图形和轴,并使用pyplot函数进行绘图。

0
投票
The next level down in the hierarchy is the first level of the object-oriented
interface, in which pyplot is used only for a few functions such as figure 
creation, and the user explicitly creates and keeps track of the figure and axes 
objects. At this level, the user uses pyplot to create figures, and through those 
figures, one or more axes objects can be created. These axes objects are then used 
for most plotting actions.
© www.soinside.com 2019 - 2024. All rights reserved.