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


Python colorbar.__doc__方法代码示例

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


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

示例1: _setup_pyplot_info_docstrings

# 需要导入模块: from matplotlib import colorbar [as 别名]
# 或者: from matplotlib.colorbar import __doc__ [as 别名]
def _setup_pyplot_info_docstrings():
    """
    Generates the plotting and docstring.

    These must be done after the entire module is imported, so it is
    called from the end of this module, which is generated by
    boilerplate.py.
    """
    # Generate the plotting docstring
    import re

    def pad(s, l):
        """Pad string *s* to length *l*."""
        if l < len(s):
            return s[:l]
        return s + ' ' * (l - len(s))

    commands = get_plot_commands()

    first_sentence = re.compile("(?:\s*).+?\.(?:\s+|$)", flags=re.DOTALL)

    # Collect the first sentence of the docstring for all of the
    # plotting commands.
    rows = []
    max_name = 0
    max_summary = 0
    for name in commands:
        doc = globals()[name].__doc__
        summary = ''
        if doc is not None:
            match = first_sentence.match(doc)
            if match is not None:
                summary = match.group(0).strip().replace('\n', ' ')
        name = '`%s`' % name
        rows.append([name, summary])
        max_name = max(max_name, len(name))
        max_summary = max(max_summary, len(summary))

    lines = []
    sep = '=' * max_name + ' ' + '=' * max_summary
    lines.append(sep)
    lines.append(' '.join([pad("Function", max_name),
                           pad("Description", max_summary)]))
    lines.append(sep)
    for name, summary in rows:
        lines.append(' '.join([pad(name, max_name),
                               pad(summary, max_summary)]))
    lines.append(sep)

    plotting.__doc__ = '\n'.join(lines)

## Plotting part 1: manually generated functions and wrappers ## 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:54,代码来源:pyplot.py

示例2: _setup_pyplot_info_docstrings

# 需要导入模块: from matplotlib import colorbar [as 别名]
# 或者: from matplotlib.colorbar import __doc__ [as 别名]
def _setup_pyplot_info_docstrings():
    """
    Generates the plotting docstring.

    These must be done after the entire module is imported, so it is
    called from the end of this module, which is generated by
    boilerplate.py.
    """
    commands = get_plot_commands()

    first_sentence = re.compile(r"(?:\s*).+?\.(?:\s+|$)", flags=re.DOTALL)

    # Collect the first sentence of the docstring for all of the
    # plotting commands.
    rows = []
    max_name = len("Function")
    max_summary = len("Description")
    for name in commands:
        doc = globals()[name].__doc__
        summary = ''
        if doc is not None:
            match = first_sentence.match(doc)
            if match is not None:
                summary = inspect.cleandoc(match.group(0)).replace('\n', ' ')
        name = '`%s`' % name
        rows.append([name, summary])
        max_name = max(max_name, len(name))
        max_summary = max(max_summary, len(summary))

    separator = '=' * max_name + ' ' + '=' * max_summary
    lines = [
        separator,
        '{:{}} {:{}}'.format('Function', max_name, 'Description', max_summary),
        separator,
    ] + [
        '{:{}} {:{}}'.format(name, max_name, summary, max_summary)
        for name, summary in rows
    ] + [
        separator,
    ]
    plotting.__doc__ = '\n'.join(lines)


## Plotting part 1: manually generated functions and wrappers ## 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:46,代码来源:pyplot.py

示例3: _setup_pyplot_info_docstrings

# 需要导入模块: from matplotlib import colorbar [as 别名]
# 或者: from matplotlib.colorbar import __doc__ [as 别名]
def _setup_pyplot_info_docstrings():
    """
    Generates the plotting and docstring.

    These must be done after the entire module is imported, so it is
    called from the end of this module, which is generated by
    boilerplate.py.
    """
    # Generate the plotting docstring
    import re

    def pad(s, l):
        """Pad string *s* to length *l*."""
        if l < len(s):
            return s[:l]
        return s + ' ' * (l - len(s))

    commands = get_plot_commands()

    first_sentence = re.compile(r"(?:\s*).+?\.(?:\s+|$)", flags=re.DOTALL)

    # Collect the first sentence of the docstring for all of the
    # plotting commands.
    rows = []
    max_name = 0
    max_summary = 0
    for name in commands:
        doc = globals()[name].__doc__
        summary = ''
        if doc is not None:
            match = first_sentence.match(doc)
            if match is not None:
                summary = match.group(0).strip().replace('\n', ' ')
        name = '`%s`' % name
        rows.append([name, summary])
        max_name = max(max_name, len(name))
        max_summary = max(max_summary, len(summary))

    lines = []
    sep = '=' * max_name + ' ' + '=' * max_summary
    lines.append(sep)
    lines.append(' '.join([pad("Function", max_name),
                           pad("Description", max_summary)]))
    lines.append(sep)
    for name, summary in rows:
        lines.append(' '.join([pad(name, max_name),
                               pad(summary, max_summary)]))
    lines.append(sep)

    plotting.__doc__ = '\n'.join(lines)

## Plotting part 1: manually generated functions and wrappers ## 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:54,代码来源:pyplot.py


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