當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。