当前位置: 首页>>代码示例>>Python>>正文


Python gridspec.SubplotSpec方法代码示例

本文整理汇总了Python中matplotlib.gridspec.SubplotSpec方法的典型用法代码示例。如果您正苦于以下问题:Python gridspec.SubplotSpec方法的具体用法?Python gridspec.SubplotSpec怎么用?Python gridspec.SubplotSpec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.gridspec的用法示例。


在下文中一共展示了gridspec.SubplotSpec方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_subplotspec

# 需要导入模块: from matplotlib import gridspec [as 别名]
# 或者: from matplotlib.gridspec import SubplotSpec [as 别名]
def get_subplotspec(self):
        'get the SubplotSpec instance'
        return self._subplotspec 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:axes_divider.py

示例2: set_subplotspec

# 需要导入模块: from matplotlib import gridspec [as 别名]
# 或者: from matplotlib.gridspec import SubplotSpec [as 别名]
def set_subplotspec(self, subplotspec):
        'set the SubplotSpec instance'
        self._subplotspec = subplotspec 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:axes_divider.py

示例3: get_subplotspec

# 需要导入模块: from matplotlib import gridspec [as 别名]
# 或者: from matplotlib.gridspec import SubplotSpec [as 别名]
def get_subplotspec(self):
        """get the SubplotSpec instance associated with the subplot"""
        return self._subplotspec 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:5,代码来源:_subplots.py

示例4: set_subplotspec

# 需要导入模块: from matplotlib import gridspec [as 别名]
# 或者: from matplotlib.gridspec import SubplotSpec [as 别名]
def set_subplotspec(self, subplotspec):
        """set the SubplotSpec instance associated with the subplot"""
        self._subplotspec = subplotspec 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:5,代码来源:_subplots.py

示例5: get_ax

# 需要导入模块: from matplotlib import gridspec [as 别名]
# 或者: from matplotlib.gridspec import SubplotSpec [as 别名]
def get_ax(ax, show=None, figsize=None, dpi=None, projection=None):
    figsize, _ = get_figure_params(figsize)
    if ax is None:
        projection = "3d" if projection == "3d" else None
        ax = pl.figure(None, figsize, dpi=dpi).gca(projection=projection)
    elif isinstance(ax, SubplotSpec):
        geo = ax.get_geometry()
        if show is None:
            show = geo[-1] + 1 == geo[0] * geo[1]
        ax = pl.subplot(ax)
    return ax, show 
开发者ID:theislab,项目名称:scvelo,代码行数:13,代码来源:utils.py

示例6: __init__

# 需要导入模块: from matplotlib import gridspec [as 别名]
# 或者: from matplotlib.gridspec import SubplotSpec [as 别名]
def __init__(self, fig, *args, **kwargs):
        """
        *fig* is a :class:`matplotlib.figure.Figure` instance.

        *args* is the tuple (*numRows*, *numCols*, *plotNum*), where
        the array of subplots in the figure has dimensions *numRows*,
        *numCols*, and where *plotNum* is the number of the subplot
        being created.  *plotNum* starts at 1 in the upper left
        corner and increases to the right.


        If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the
        decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*.
        """

        self.figure = fig

        if len(args) == 1:
            if isinstance(args[0], SubplotSpec):
                self._subplotspec = args[0]
            else:
                try:
                    s = str(int(args[0]))
                    rows, cols, num = list(map(int, s))
                except ValueError:
                    raise ValueError(
                        'Single argument to subplot must be a 3-digit '
                        'integer')
                self._subplotspec = GridSpec(rows, cols)[num - 1]
                # num - 1 for converting from MATLAB to python indexing
        elif len(args) == 3:
            rows, cols, num = args
            rows = int(rows)
            cols = int(cols)
            if isinstance(num, tuple) and len(num) == 2:
                num = [int(n) for n in num]
                self._subplotspec = GridSpec(rows, cols)[num[0] - 1:num[1]]
            else:
                if num < 0 or num > rows*cols:
                    raise ValueError(
                        "num must be 0 <= num <= {maxn}, not {num}".format(
                            maxn=rows*cols, num=num))
                if num == 0:
                    warnings.warn("The use of 0 (which ends up being the "
                                  "_last_ sub-plot) is deprecated in 1.4 "
                                  "and will raise an error in 1.5",
                                  mplDeprecation)
                self._subplotspec = GridSpec(rows, cols)[int(num) - 1]
                # num - 1 for converting from MATLAB to python indexing
        else:
            raise ValueError('Illegal argument(s) to subplot: %s' % (args,))

        self.update_params()

        # _axes_class is set in the subplot_class_factory
        self._axes_class.__init__(self, fig, self.figbox, **kwargs) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:58,代码来源:_subplots.py

示例7: __init__

# 需要导入模块: from matplotlib import gridspec [as 别名]
# 或者: from matplotlib.gridspec import SubplotSpec [as 别名]
def __init__(self, fig, *args, horizontal=None, vertical=None,
                 aspect=None, anchor='C'):
        """
        Parameters
        ----------
        fig : :class:`matplotlib.figure.Figure`
        args : tuple (*numRows*, *numCols*, *plotNum*)
            The array of subplots in the figure has dimensions *numRows*,
            *numCols*, and *plotNum* is the number of the subplot
            being created.  *plotNum* starts at 1 in the upper left
            corner and increases to the right.

            If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the
            decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*.
        """

        self.figure = fig

        if len(args) == 1:
            if isinstance(args[0], SubplotSpec):
                self._subplotspec = args[0]
            else:
                try:
                    s = str(int(args[0]))
                    rows, cols, num = map(int, s)
                except ValueError:
                    raise ValueError(
                        'Single argument to subplot must be a 3-digit integer')
                self._subplotspec = GridSpec(rows, cols)[num-1]
                # num - 1 for converting from MATLAB to python indexing
        elif len(args) == 3:
            rows, cols, num = args
            rows = int(rows)
            cols = int(cols)
            if isinstance(num, tuple) and len(num) == 2:
                num = [int(n) for n in num]
                self._subplotspec = GridSpec(rows, cols)[num[0]-1:num[1]]
            else:
                self._subplotspec = GridSpec(rows, cols)[int(num)-1]
                # num - 1 for converting from MATLAB to python indexing
        else:
            raise ValueError('Illegal argument(s) to subplot: %s' % (args,))

        # total = rows*cols
        # num -= 1    # convert from matlab to python indexing
        #             # i.e., num in range(0,total)
        # if num >= total:
        #     raise ValueError( 'Subplot number exceeds total subplots')
        # self._rows = rows
        # self._cols = cols
        # self._num = num

        # self.update_params()

        # sets self.fixbox
        self.update_params()

        pos = self.figbox.bounds

        Divider.__init__(self, fig, pos, horizontal or [], vertical or [],
                         aspect=aspect, anchor=anchor) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:63,代码来源:axes_divider.py

示例8: __init__

# 需要导入模块: from matplotlib import gridspec [as 别名]
# 或者: from matplotlib.gridspec import SubplotSpec [as 别名]
def __init__(self, fig, *args, horizontal=None, vertical=None,
                 aspect=None, anchor='C'):
        """
        Parameters
        ----------
        fig : :class:`matplotlib.figure.Figure`
        *args : tuple (*numRows*, *numCols*, *plotNum*)
            The array of subplots in the figure has dimensions *numRows*,
            *numCols*, and *plotNum* is the number of the subplot
            being created.  *plotNum* starts at 1 in the upper left
            corner and increases to the right.

            If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the
            decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*.
        """

        self.figure = fig

        if len(args) == 1:
            if isinstance(args[0], SubplotSpec):
                self._subplotspec = args[0]
            else:
                try:
                    s = str(int(args[0]))
                    rows, cols, num = map(int, s)
                except ValueError:
                    raise ValueError(
                        'Single argument to subplot must be a 3-digit integer')
                self._subplotspec = GridSpec(rows, cols)[num-1]
                # num - 1 for converting from MATLAB to python indexing
        elif len(args) == 3:
            rows, cols, num = args
            rows = int(rows)
            cols = int(cols)
            if isinstance(num, tuple) and len(num) == 2:
                num = [int(n) for n in num]
                self._subplotspec = GridSpec(rows, cols)[num[0]-1:num[1]]
            else:
                self._subplotspec = GridSpec(rows, cols)[int(num)-1]
                # num - 1 for converting from MATLAB to python indexing
        else:
            raise ValueError(f'Illegal argument(s) to subplot: {args}')

        # total = rows*cols
        # num -= 1    # convert from matlab to python indexing
        #             # i.e., num in range(0,total)
        # if num >= total:
        #     raise ValueError( 'Subplot number exceeds total subplots')
        # self._rows = rows
        # self._cols = cols
        # self._num = num

        # self.update_params()

        # sets self.fixbox
        self.update_params()

        pos = self.figbox.bounds

        Divider.__init__(self, fig, pos, horizontal or [], vertical or [],
                         aspect=aspect, anchor=anchor) 
开发者ID:boris-kz,项目名称:CogAlg,代码行数:63,代码来源:axes_divider.py


注:本文中的matplotlib.gridspec.SubplotSpec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。