matplotlib.gridspec.SubplotSpec¶
-
class
matplotlib.gridspec.
SubplotSpec
(gridspec, num1, num2=None)[源代码]¶ 基类:
object
中指定子批次的位置
GridSpec
.注解
很可能,您永远不会实例化
SubplotSpec
你自己。相反,您通常会从GridSpec
使用项目访问。参数: -
__dict__
= mappingproxy({'__module__': 'matplotlib.gridspec', '__doc__': "\n Specifies the location of a subplot in a `GridSpec`.\n\n .. note::\n\n Likely, you'll never instantiate a `SubplotSpec` yourself. Instead you\n will typically obtain one from a `GridSpec` using item-access.\n\n Parameters\n ----------\n gridspec : `~matplotlib.gridspec.GridSpec`\n The GridSpec, which the subplot is referencing.\n num1, num2 : int\n The subplot will occupy the num1-th cell of the given\n gridspec. If num2 is provided, the subplot will span between\n num1-th cell and num2-th cell *inclusive*.\n\n The index starts from 0.\n ", '__init__': <function SubplotSpec.__init__>, '__repr__': <function SubplotSpec.__repr__>, '_from_subplot_args': <staticmethod object>, 'num2': <property object>, '__getstate__': <function SubplotSpec.__getstate__>, 'get_gridspec': <function SubplotSpec.get_gridspec>, 'get_geometry': <function SubplotSpec.get_geometry>, 'get_rows_columns': <function SubplotSpec.get_rows_columns>, 'rowspan': <property object>, 'colspan': <property object>, 'get_position': <function SubplotSpec.get_position>, 'get_topmost_subplotspec': <function SubplotSpec.get_topmost_subplotspec>, '__eq__': <function SubplotSpec.__eq__>, '__hash__': <function SubplotSpec.__hash__>, 'subgridspec': <function SubplotSpec.subgridspec>, '__dict__': <attribute '__dict__' of 'SubplotSpec' objects>, '__weakref__': <attribute '__weakref__' of 'SubplotSpec' objects>, '__annotations__': {}})¶
-
__module__
= 'matplotlib.gridspec'¶
-
__weakref__
¶ 对象的弱引用列表(如果已定义)
-
get_geometry
()[源代码]¶ 以元组形式返回子批次几何体
(n_rows, n_cols, start, stop)
.指数 开始 和 stop 在中定义子批次的范围
GridSpec
. stop 包含(即单个单元格start == stop
)
-
get_rows_columns
()[源代码]¶ [Deprecated] 以元组形式返回子批次的行和列号
(n_rows, n_cols, row_start, row_stop, col_start, col_stop)
.笔记
3.3 版后已移除.
-
get_topmost_subplotspec
()[源代码]¶ 返回最上面的
SubplotSpec
与子批次关联的实例。
-
property
num2
¶
-
subgridspec
(nrows, ncols, **kwargs)[源代码]¶ 在此子批次中创建一个GridSpec。
创造的
GridSpecFromSubplotSpec
会有这个吗SubplotSpec
作为父母。参数: - nrows利息
网格中的行数。
- ncols利息
网格中的数字或列。
返回: 其他参数: - **kwargs
所有其他参数都传递给
GridSpecFromSubplotSpec
.
实例
在单个子块占用的空间中添加三个子块::
fig = plt.figure() gs0 = fig.add_gridspec(3, 1) ax1 = fig.add_subplot(gs0[0]) ax2 = fig.add_subplot(gs0[1]) gssub = gs0[2].subgridspec(1, 3) for i in range(3): fig.add_subplot(gssub[0, i])
-