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