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


Python Plot.close_figure方法代码示例

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


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

示例1: main

# 需要导入模块: from plot import Plot [as 别名]
# 或者: from plot.Plot import close_figure [as 别名]
def main():
    figure = Plot.new_figure(figsize=(5,10))

    data_path = lambda x: os.path.join('json', 'fig_4d_difference_' + x + '_lifetime.json')
    fits = [ Fit(data_path(fig)) for fig in ['large', 'larger'] ]

    for fit in fits:
        fit.maps['value_transforms']['τ'] = lambda x: '%.2E' % round(x, 2)
        fit.meta['contact_type'] = 'transparent'

    plots = []
    for idx, fit in enumerate(fits):
        n, m = 2, 1

        options = {}
        if idx != 0: options['sharex'] = plots[idx - 1].plt

        plot = Plot(fit, figure.add_subplot(n, m, (m * idx + 1), **options))
        plot.id = 'd.' + str(idx + 1)
        plots.append(plot)

    for plot in plots:
        plot.plot_data()
        plot.plot_fit()
        plot.add_ylabel()
        plot.add_parameter_overlay()

    plots[-1].add_xlabel()
    matplotlib.pyplot.setp(plots[0].plt.get_xticklabels(), visible=False)

    figure.savefig(os.path.join('build', 'plot_fits_large_lifetime.eps'), transparent=True)
    plots[0].fit.save_info('build/plot_fits_large_lifetime_info.tex', 'plotFitsLargeLifetimeInfo')
    Plot.close_figure(figure)
开发者ID:evansosenko,项目名称:aps-spin-lifetime-plots,代码行数:35,代码来源:plot_fits_large_lifetime.py

示例2: main

# 需要导入模块: from plot import Plot [as 别名]
# 或者: from plot.Plot import close_figure [as 别名]
def main():
    figure = Plot.new_figure(figsize=(5,10))
    fit_ids = ['a', 'b', 'c', 'd']

    def data_path(fit_id):
        if fit_id == 'c':
            fit_type = 'parallel'
        else:
            fit_type = 'difference'
        return os.path.join('json', 'fig_4' + fit_id + '_' + fit_type + '.json')

    fits = [ Fit(data_path(fig)) for fig in fit_ids ]

    for fit in fits[0:3]:
        fit.maps['value_transforms']['Ω_C'] = lambda x: '%.2E' % round(x, 2)

    for i in (0, 1): fits[i].meta['contact_type'] = 'tunneling'
    fits[2].meta['contact_type'] = 'pinhole'
    fits[3].meta['contact_type'] = 'transparent'

    plots = []
    for idx, fit in enumerate(fits):
        n, m = 4, 1

        options = {}
        if idx != 0: options['sharex'] = plots[idx - 1].plt

        plot = Plot(fit, figure.add_subplot(n, m, (m * idx + 1), **options))
        plot.id = fit_ids[idx]
        plots.append(plot)

    for idx, plot in enumerate(plots):
        plot.plot_data()
        plot.plot_fit()

        if idx == 2:
            plot.add_ylabel(False)
        else:
            plot.add_ylabel(True)

        plot.add_parameter_overlay()

    plots[-1].add_xlabel()
    matplotlib.pyplot.setp([ p.plt.get_xticklabels() for p in plots[0:3] ], visible=False)

    figure.savefig(os.path.join('build', 'plot_fits.eps'), transparent=True)
    plots[0].fit.save_info('build/plot_fits_info.tex', 'plotFitsInfo')
    Plot.close_figure(figure)
开发者ID:evansosenko,项目名称:aps-spin-lifetime-plots,代码行数:50,代码来源:plot_fits.py


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