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


Python ticker.PercentFormatter方法代码示例

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


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

示例1: test_basic

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import PercentFormatter [as 别名]
def test_basic(self, xmax, decimals, symbol,
                   x, display_range, expected):
        formatter = mticker.PercentFormatter(xmax, decimals, symbol)
        with matplotlib.rc_context(rc={'text.usetex': False}):
            assert formatter.format_pct(x, display_range) == expected 
开发者ID:holzschu,项目名称:python3_ios,代码行数:7,代码来源:test_ticker.py

示例2: test_latex

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import PercentFormatter [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

示例3: test_element_xformatter_instance

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import PercentFormatter [as 别名]
def test_element_xformatter_instance(self):
        formatter = PercentFormatter()
        curve = Curve(range(10)).options(xformatter=formatter)
        plot = mpl_renderer.get_plot(curve)
        xaxis = plot.handles['axis'].xaxis
        xformatter = xaxis.get_major_formatter()
        self.assertIs(xformatter, formatter) 
开发者ID:holoviz,项目名称:holoviews,代码行数:9,代码来源:testelementplot.py

示例4: test_element_yformatter_instance

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import PercentFormatter [as 别名]
def test_element_yformatter_instance(self):
        formatter = PercentFormatter()
        curve = Curve(range(10)).options(yformatter=formatter)
        plot = mpl_renderer.get_plot(curve)
        yaxis = plot.handles['axis'].yaxis
        yformatter = yaxis.get_major_formatter()
        self.assertIs(yformatter, formatter) 
开发者ID:holoviz,项目名称:holoviews,代码行数:9,代码来源:testelementplot.py

示例5: test_element_zformatter_instance

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import PercentFormatter [as 别名]
def test_element_zformatter_instance(self):
        formatter = PercentFormatter()
        curve = Scatter3D([]).options(zformatter=formatter)
        plot = mpl_renderer.get_plot(curve)
        zaxis = plot.handles['axis'].zaxis
        zformatter = zaxis.get_major_formatter()
        self.assertIs(zformatter, formatter) 
开发者ID:holoviz,项目名称:holoviews,代码行数:9,代码来源:testelementplot.py

示例6: plot_rs_dist_overlap

# 需要导入模块: from matplotlib import ticker [as 别名]
# 或者: from matplotlib.ticker import PercentFormatter [as 别名]
def plot_rs_dist_overlap(rs, fig_title, mean=False, median=False, color=None, methodName=None):
    return_in_percent = np.array(rs) / rl_constants.initial_cash
#     stat = plt.hist(return_in_percent, bins=30, weights=np.ones(len(return_in_percent)) / len(return_in_percent))
    y, binEdges = np.histogram(return_in_percent, bins=50, density=True)
    
    bincenters = 0.5*(binEdges[1:]+binEdges[:-1])
    plt.plot(bincenters,y,'-', color=color, label=methodName)
    
    mean_stat = return_in_percent.mean()
    median_stat = np.median(return_in_percent)
    
    if mean:
        plt.axvline(mean_stat, color=color, linestyle='dashed', linewidth=1, label=methodName+' Mean: {:.3f}'.format(mean_stat))
    if median:
        plt.axvline(median_stat, color=color, linestyle='dashed', linewidth=1, label=methodName+' Median: {:.3f}'.format(median_stat))
    
    plt.gcf().set_size_inches(14, 7)
#     plt.gca().yaxis.set_major_formatter(PercentFormatter(1))
    plt.gca().xaxis.set_major_formatter(PercentFormatter(1))
    
    if len(fig_title) != 0:
        plt.suptitle(fig_title)
    plt.xlabel('return')
    plt.ylabel('density of the distribution of all pairs')
    plt.legend(loc='upper right')
#     print(stat)
    _logger.info('Number of pairs:', len(return_in_percent))
    _logger.info('Mean return over all pairs: {:.4f}'.format(np.mean(return_in_percent)))

    
# global batch_id to keep track of the progress 
开发者ID:wywongbd,项目名称:pairstrade-fyp-2019,代码行数:33,代码来源:rl_train.py


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