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


Python pyplot.rc_context方法代码示例

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


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

示例1: test_rc_grid

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def test_rc_grid():
    fig = plt.figure()
    rc_dict0 = {
        'axes.grid': True,
        'axes.grid.axis': 'both'
    }
    rc_dict1 = {
        'axes.grid': True,
        'axes.grid.axis': 'x'
    }
    rc_dict2 = {
        'axes.grid': True,
        'axes.grid.axis': 'y'
    }
    dict_list = [rc_dict0, rc_dict1, rc_dict2]

    i = 1
    for rc_dict in dict_list:
        with matplotlib.rc_context(rc_dict):
            fig.add_subplot(3, 1, i)
            i += 1 
开发者ID:holzschu,项目名称:python3_ios,代码行数:23,代码来源:test_axes.py

示例2: test_rc_tick

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def test_rc_tick():
    d = {'xtick.bottom': False, 'xtick.top': True,
         'ytick.left': True, 'ytick.right': False}
    with plt.rc_context(rc=d):
        fig = plt.figure()
        ax1 = fig.add_subplot(1, 1, 1)
        xax = ax1.xaxis
        yax = ax1.yaxis
        # tick1On bottom/left
        assert not xax._major_tick_kw['tick1On']
        assert xax._major_tick_kw['tick2On']
        assert not xax._minor_tick_kw['tick1On']
        assert xax._minor_tick_kw['tick2On']

        assert yax._major_tick_kw['tick1On']
        assert not yax._major_tick_kw['tick2On']
        assert yax._minor_tick_kw['tick1On']
        assert not yax._minor_tick_kw['tick2On'] 
开发者ID:holzschu,项目名称:python3_ios,代码行数:20,代码来源:test_axes.py

示例3: test_minorticks_rc

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def test_minorticks_rc():
    fig = plt.figure()

    def minorticksubplot(xminor, yminor, i):
        rc = {'xtick.minor.visible': xminor,
              'ytick.minor.visible': yminor}
        with plt.rc_context(rc=rc):
            ax = fig.add_subplot(2, 2, i)

        assert (len(ax.xaxis.get_minor_ticks()) > 0) == xminor
        assert (len(ax.yaxis.get_minor_ticks()) > 0) == yminor

    minorticksubplot(False, False, 1)
    minorticksubplot(True, False, 2)
    minorticksubplot(False, True, 3)
    minorticksubplot(True, True, 4) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:18,代码来源:test_ticker.py

示例4: test_rc_major_minor_tick

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def test_rc_major_minor_tick():
    d = {'xtick.top': True, 'ytick.right': True,  # Enable all ticks
         'xtick.bottom': True, 'ytick.left': True,
         # Selectively disable
         'xtick.minor.bottom': False, 'xtick.major.bottom': False,
         'ytick.major.left': False, 'ytick.minor.left': False}
    with plt.rc_context(rc=d):
        fig = plt.figure()
        ax1 = fig.add_subplot(1, 1, 1)
        xax = ax1.xaxis
        yax = ax1.yaxis
        # tick1On bottom/left
        assert not xax._major_tick_kw['tick1On']
        assert xax._major_tick_kw['tick2On']
        assert not xax._minor_tick_kw['tick1On']
        assert xax._minor_tick_kw['tick2On']

        assert not yax._major_tick_kw['tick1On']
        assert yax._major_tick_kw['tick2On']
        assert not yax._minor_tick_kw['tick1On']
        assert yax._minor_tick_kw['tick2On'] 
开发者ID:jgagneastro,项目名称:coffeegrindsize,代码行数:23,代码来源:test_axes.py

示例5: _gca

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def _gca(rc=None):
    import matplotlib.pyplot as plt
    with plt.rc_context(rc):
        return plt.gca() 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:6,代码来源:_core.py

示例6: draw

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def draw(self, renderer):
        with plt.rc_context({"text.usetex": self.usetex,
                             "text.latex.preview": self.preview}):
            super().draw(renderer) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:6,代码来源:usetex_baseline_test.py

示例7: _rc_test_bxp_helper

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def _rc_test_bxp_helper(ax, rc_dict):
    x = np.linspace(-7, 7, 140)
    x = np.hstack([-25, x, 25])
    with matplotlib.rc_context(rc_dict):
        ax.boxplot([x, x])
    return ax 
开发者ID:holzschu,项目名称:python3_ios,代码行数:8,代码来源:test_axes.py

示例8: test_rc_spines

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def test_rc_spines():
    rc_dict = {
        'axes.spines.left': False,
        'axes.spines.right': False,
        'axes.spines.top': False,
        'axes.spines.bottom': False}
    with matplotlib.rc_context(rc_dict):
        fig, ax = plt.subplots() 
开发者ID:holzschu,项目名称:python3_ios,代码行数:10,代码来源:test_axes.py

示例9: test_view_limits

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def test_view_limits(self):
        """
        Test basic behavior of view limits.
        """
        with matplotlib.rc_context({'axes.autolimit_mode': 'data'}):
            loc = mticker.MultipleLocator(base=3.147)
            assert_almost_equal(loc.view_limits(-5, 5), (-5, 5)) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:9,代码来源:test_ticker.py

示例10: test_view_limits_round_numbers

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def test_view_limits_round_numbers(self):
        """
        Test that everything works properly with 'round_numbers' for auto
        limit.
        """
        with matplotlib.rc_context({'axes.autolimit_mode': 'round_numbers'}):
            loc = mticker.MultipleLocator(base=3.147)
            assert_almost_equal(loc.view_limits(-4, 4), (-6.294, 6.294)) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:10,代码来源:test_ticker.py

示例11: test_use_offset

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def test_use_offset(self, use_offset):
        with matplotlib.rc_context({'axes.formatter.useoffset': use_offset}):
            tmp_form = mticker.ScalarFormatter()
            assert use_offset == tmp_form.get_useOffset() 
开发者ID:holzschu,项目名称:python3_ios,代码行数:6,代码来源:test_ticker.py

示例12: test_min_exponent

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def test_min_exponent(self, min_exponent, value, expected):
        with matplotlib.rc_context({'axes.formatter.min_exponent':
                                    min_exponent}):
            assert self.fmt(value) == expected 
开发者ID:holzschu,项目名称:python3_ios,代码行数:6,代码来源:test_ticker.py

示例13: test_basic

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def test_basic(self, base, value, expected):
        formatter = mticker.LogFormatterSciNotation(base=base)
        formatter.sublabel = {1, 2, 5, 1.2}
        with matplotlib.rc_context({'text.usetex': False}):
            assert formatter(value) == expected 
开发者ID:holzschu,项目名称:python3_ios,代码行数:7,代码来源:test_ticker.py

示例14: test_latex

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def test_latex(self, is_latex, usetex, expected):
        fmt = mticker.PercentFormatter(symbol='\\{t}%', is_latex=is_latex)
        with matplotlib.rc_context(rc={'text.usetex': usetex}):
            assert fmt.format_pct(50, 100) == expected 
开发者ID:holzschu,项目名称:python3_ios,代码行数:6,代码来源:test_ticker.py

示例15: view

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rc_context [as 别名]
def view(self, test=False):
        """Displays the graph"""

        if test:
            self._attr["style"] = True
            AttrConf.MPL_STYLE["interactive"] = False

        permute = self._attr["permute"] and not self._attr["concat"]
        if self._attr["style"]:
            with plt.rc_context(AttrConf.MPL_STYLE):
                self._resolve(permute, self._attr["concat"])
        else:
            self._resolve(permute, self._attr["concat"]) 
开发者ID:ARM-software,项目名称:trappy,代码行数:15,代码来源:StaticPlot.py


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