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


Python FigureCanvasAgg.print_tif方法代码示例

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


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

示例1: plot_greyscale_boxplot

# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import print_tif [as 别名]
def plot_greyscale_boxplot(graph_image, description, sample_type, sample_df, colors, y_limit, min_length, max_length, plot_mean):
    pyplot.rc('font',**{'family':'sans-serif','sans-serif':[JOURNAL_FONT]})

    for dpi in JOURNAL_GRAPH_DPIS:
        figure = Figure(dpi=dpi)
        figure.patch.set_facecolor('white')
        ax = figure.add_subplot(1, 1, 1)
    
        for (condition, df) in sample_df.groupby(CONDITION):
            numeric_columns = df.columns - GROUP_BY_COLUMNS
            numeric_df = df[numeric_columns]
    
            # Remove 0 length from boxplot - it will use axis 1... for elements 0... 
            boxplot_df = numeric_df[numeric_df.columns[1:]]
    
            data_lists = []
            for column in boxplot_df:
                data_lists.append(boxplot_df[column])
    
            if plot_mean:
                lines = ax.plot(numeric_df.mean(axis=0), linestyle='dashed', zorder=-1)
                pyplot.setp(lines, color=colors[condition])
                
            r = ax.boxplot(data_lists, patch_artist=True)
            pyplot.setp(r.values(), color=colors[condition], lw=1)
            pyplot.setp(r['boxes'], facecolor='white')
    
            patches = []
            labels = []
            for name in ["WT", "pin/pin"]:
                color = colors[name]
                labels.append(name)
                patches.append(Rectangle((0, 0), 1, 1, fc=color))
            
            ax.legend(patches, labels, loc=2)
    
        # Only show range we're interested in
        # Use .5 to get a bit of spacing, & don't show numbers either side
        ax.set_xlim(min_length - .5, max_length + .5) 
        ax.set_ylim(0, y_limit)
        ax.set_xlabel("Read length", weight='bold', size=14)
        ax.set_ylabel("Percentage of %s" % description, weight='bold', size=14)
        ax.set_title(sample_type, weight='bold', size=18)
    
        canvas = FigureCanvasAgg(figure)
        canvas.print_tif(graph_image + '_%s_dpi.tiff' % dpi)
        canvas.print_png(graph_image + '_%d_dpi.png' % dpi)
开发者ID:henmt,项目名称:2015,代码行数:49,代码来源:lim_pirna_sequence_length_analysis.py


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