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


Python matplotlib.rcdefaults方法代码示例

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


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

示例1: context

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def context(name, after_reset=False):
    """Context manager for using style settings temporarily.

    Parameters
    ----------
    name : str or list of str
        Name of style or path/URL to a style file. For a list of available
        style names, see `style.available`. If given a list, each style is
        applied from first to last in the list.
    after_reset : bool
        If True, apply style after resetting settings to their defaults;
        otherwise, apply style on top of the current settings.
    """
    initial_settings = mpl.rcParams.copy()
    if after_reset:
        mpl.rcdefaults()
    use(name)
    yield
    mpl.rcParams.update(initial_settings) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:21,代码来源:core.py

示例2: setup

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def setup():
    # The baseline images are created in this locale, so we should use
    # it during all of the tests.

    try:
        locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
    except locale.Error:
        try:
            locale.setlocale(locale.LC_ALL, 'English_United States.1252')
        except locale.Error:
            warnings.warn(
                "Could not set locale to English/United States. "
                "Some date-related tests may fail.")

    mpl.use('Agg', force=True, warn=False)  # use Agg backend for these tests

    with warnings.catch_warnings():
        warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
        mpl.rcdefaults()  # Start with all defaults

    # These settings *must* be hardcoded for running the comparison tests and
    # are not necessarily the default values as specified in rcsetup.py.
    set_font_settings_for_testing()
    set_reproducibility_for_testing() 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:26,代码来源:__init__.py

示例3: reset_matplotlib

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def reset_matplotlib():
    """
    Reset matplotlib to a common default.
    """
    # Set all default values.
    mpl.rcdefaults()
    # Force agg backend.
    plt.switch_backend('agg')
    # These settings must be hardcoded for running the comparision tests and
    # are not necessarily the default values.
    mpl.rcParams['font.family'] = 'Bitstream Vera Sans'
    mpl.rcParams['text.hinting'] = False
    # Not available for all matplotlib versions.
    try:
        mpl.rcParams['text.hinting_factor'] = 8
    except KeyError:
        pass
    import locale
    locale.setlocale(locale.LC_ALL, str('en_US.UTF-8'))


# Most generic way to get the data folder path. 
开发者ID:computational-seismology,项目名称:pytomo3d,代码行数:24,代码来源:test_window.py

示例4: deactivate

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def deactivate():
        """
        Deactivate the current style and restore the default. Do not use this directly. Use the
        `with plot_style([style name])` context manager instead.

        :return: None
        """

        # Restore matplotlib defaults

        mpl.rcdefaults()

        # Restore 3ML default

        global current_style

        current_style = defined_styles["default"] 
开发者ID:threeML,项目名称:threeML,代码行数:19,代码来源:plot_style.py

示例5: setup

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def setup():
    # The baseline images are created in this locale, so we should use
    # it during all of the tests.

    try:
        locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
    except locale.Error:
        try:
            locale.setlocale(locale.LC_ALL, 'English_United States.1252')
        except locale.Error:
            _log.warning(
                "Could not set locale to English/United States. "
                "Some date-related tests may fail.")

    mpl.use('Agg', force=True, warn=False)  # use Agg backend for these tests

    with cbook._suppress_matplotlib_deprecation_warning():
        mpl.rcdefaults()  # Start with all defaults

    # These settings *must* be hardcoded for running the comparison tests and
    # are not necessarily the default values as specified in rcsetup.py.
    set_font_settings_for_testing()
    set_reproducibility_for_testing() 
开发者ID:boris-kz,项目名称:CogAlg,代码行数:25,代码来源:__init__.py

示例6: setup

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def setup():
    # The baseline images are created in this locale, so we should use
    # it during all of the tests.
    import locale
    from matplotlib.backends import backend_agg, backend_pdf, backend_svg

    try:
        locale.setlocale(locale.LC_ALL, str('en_US.UTF-8'))
    except locale.Error:
        try:
            locale.setlocale(locale.LC_ALL, str('English_United States.1252'))
        except locale.Error:
            warnings.warn(
                "Could not set locale to English/United States. "
                "Some date-related tests may fail")

    mpl.use('Agg', warn=False)  # use Agg backend for these tests

    # These settings *must* be hardcoded for running the comparison
    # tests and are not necessarily the default values as specified in
    # rcsetup.py
    mpl.rcdefaults()  # Start with all defaults

    set_font_settings_for_testing()
    set_reproducibility_for_testing() 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:27,代码来源:__init__.py

示例7: setup_method

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def setup_method(self, method):
        TestPlotBase.setup_method(self, method)
        import matplotlib as mpl
        mpl.rcdefaults()

        self.ts = tm.makeTimeSeries()
        self.ts.name = 'ts' 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:9,代码来源:test_misc.py

示例8: setup_method

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def setup_method(self, method):
        TestPlotBase.setup_method(self, method)
        import matplotlib as mpl
        mpl.rcdefaults()

        self.tdf = tm.makeTimeDataFrame()
        self.hexbin_df = DataFrame({"A": np.random.uniform(size=20),
                                    "B": np.random.uniform(size=20),
                                    "C": np.arange(20) + np.random.uniform(
                                        size=20)}) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:12,代码来源:test_frame.py

示例9: setup_method

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def setup_method(self, method):
        TestPlotBase.setup_method(self, method)
        import matplotlib as mpl
        mpl.rcdefaults()

        self.ts = tm.makeTimeSeries()
        self.ts.name = 'ts'

        self.series = tm.makeStringSeries()
        self.series.name = 'series'

        self.iseries = tm.makePeriodSeries()
        self.iseries.name = 'iseries' 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:15,代码来源:test_series.py

示例10: setup_method

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def setup_method(self, method):

        import matplotlib as mpl
        mpl.rcdefaults()

        self.mpl_ge_2_0_1 = plotting._compat._mpl_ge_2_0_1()
        self.mpl_ge_2_1_0 = plotting._compat._mpl_ge_2_1_0()
        self.mpl_ge_2_2_0 = plotting._compat._mpl_ge_2_2_0()
        self.mpl_ge_2_2_2 = plotting._compat._mpl_ge_2_2_2()
        self.mpl_ge_3_0_0 = plotting._compat._mpl_ge_3_0_0()

        self.bp_n_objects = 7
        self.polycollection_factor = 2
        self.default_figsize = (6.4, 4.8)
        self.default_tick_position = 'left'

        n = 100
        with tm.RNGContext(42):
            gender = np.random.choice(['Male', 'Female'], size=n)
            classroom = np.random.choice(['A', 'B', 'C'], size=n)

            self.hist_df = DataFrame({'gender': gender,
                                      'classroom': classroom,
                                      'height': random.normal(66, 4, size=n),
                                      'weight': random.normal(161, 32, size=n),
                                      'category': random.randint(4, size=n)})

        self.tdf = tm.makeTimeDataFrame()
        self.hexbin_df = DataFrame({"A": np.random.uniform(size=20),
                                    "B": np.random.uniform(size=20),
                                    "C": np.arange(20) + np.random.uniform(
                                        size=20)}) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:34,代码来源:common.py

示例11: __call__

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def __call__(self, **kwargs):
        """Figure realizer

        The Figure class only keeps track of a root panel.  It does
        not contain an actual matplotlib Figure instance.  Whenever a
        figure needs to be created, Figure creates a new matplotlib
        Figure in order to drew/rendered/realized the figure.

        Args:

            **kwargs (dict): Arbitrary Figure-specific keyworded
                arguments that are used to construct the matplotlib
                Figure.

        """
        kwprops = merge_dict(self.kwprops, kwargs)
        style   = kwprops.pop('style')

        with mpl.rc_context():
            mpl.rcdefaults()
            plt.style.use(style)

            imode = mpl.is_interactive()
            if imode:
                plt.ioff()

            fig = plt.figure(**kwprops)
            ax  = newaxes(fig)
            yield fig, ax

            if imode:
                plt.ion() 
开发者ID:liamedeiros,项目名称:ehtplot,代码行数:34,代码来源:figure.py

示例12: rcdefaults

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def rcdefaults():
    matplotlib.rcdefaults()
    draw_if_interactive()


# The current "image" (ScalarMappable) is retrieved or set
# only via the pyplot interface using the following two
# functions: 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:10,代码来源:pyplot.py

示例13: context

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def context(style, after_reset=False):
    """Context manager for using style settings temporarily.

    Parameters
    ----------
    style : str, dict, or list
        A style specification. Valid options are:

        +------+-------------------------------------------------------------+
        | str  | The name of a style or a path/URL to a style file. For a    |
        |      | list of available style names, see `style.available`.       |
        +------+-------------------------------------------------------------+
        | dict | Dictionary with valid key/value pairs for                   |
        |      | `matplotlib.rcParams`.                                      |
        +------+-------------------------------------------------------------+
        | list | A list of style specifiers (str or dict) applied from first |
        |      | to last in the list.                                        |
        +------+-------------------------------------------------------------+

    after_reset : bool
        If True, apply style after resetting settings to their defaults;
        otherwise, apply style on top of the current settings.
    """
    with mpl.rc_context():
        if after_reset:
            mpl.rcdefaults()
        use(style)
        yield 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:30,代码来源:core.py

示例14: switch_backend

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def switch_backend(backend):

    def switch_backend_decorator(func):
        def backend_switcher(*args, **kwargs):
            try:
                prev_backend = mpl.get_backend()
                mpl.rcdefaults()
                plt.switch_backend(backend)
                result = func(*args, **kwargs)
            finally:
                plt.switch_backend(prev_backend)
            return result

        return nose.tools.make_decorator(func)(backend_switcher)
    return switch_backend_decorator 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:17,代码来源:test_backend_pgf.py

示例15: rcdefaults

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import rcdefaults [as 别名]
def rcdefaults():
    matplotlib.rcdefaults()
    if matplotlib.is_interactive():
        draw_all()


## Current image ## 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:9,代码来源:pyplot.py


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