def generate_timing_breakdown_plot(timing_stats, scaling_var, title, description, plot_file):
<EOL>cmap_data = colormaps._viridis_data<EOL>n_subplots = len(six.viewkeys(timing_stats))<EOL>fig, ax = plt.subplots(<NUM_LIT:1>, n_subplots+<NUM_LIT:1>, figsize=(<NUM_LIT:3>*(n_subplots+<NUM_LIT:2>), <NUM_LIT:5>))<EOL>for plot_num, p_count in enumerate(<EOL>sorted(six.iterkeys(timing_stats), key=functions.sort_processor_counts)):<EOL><INDENT>case_data = timing_stats[p_count]<EOL>all_timers = set(six.iterkeys(case_data['<STR_LIT>'])) | set(six.iterkeys(case_data['<STR_LIT>']))<EOL>all_timers = sorted(list(all_timers), reverse=True)<EOL>cmap_stride = int(len(cmap_data)/(len(all_timers)+<NUM_LIT:1>))<EOL>colors = {all_timers[i]: cmap_data[i*cmap_stride] for i in range(len(all_timers))}<EOL>sub_ax = plt.subplot(<NUM_LIT:1>, n_subplots+<NUM_LIT:1>, plot_num+<NUM_LIT:1>)<EOL>sub_ax.set_title(p_count)<EOL>sub_ax.set_ylabel('<STR_LIT>')<EOL>for case, var_data in case_data.items():<EOL><INDENT>if case == '<STR_LIT>':<EOL><INDENT>bar_num = <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>bar_num = <NUM_LIT:1><EOL><DEDENT>offset = <NUM_LIT:0><EOL>if var_data != {}:<EOL><INDENT>for var in sorted(six.iterkeys(var_data), reverse=True):<EOL><INDENT>if var != scaling_var:<EOL><INDENT>plt.bar(bar_num, var_data[var]['<STR_LIT>'], <NUM_LIT>, bottom=offset,<EOL>color=colors[var], label=(var if bar_num == <NUM_LIT:1> else '<STR_LIT>'))<EOL>offset += var_data[var]['<STR_LIT>']<EOL><DEDENT><DEDENT>plt.bar(bar_num, var_data[scaling_var]['<STR_LIT>']-offset, <NUM_LIT>, bottom=offset,<EOL>color=colors[scaling_var], label=(scaling_var if bar_num == <NUM_LIT:1> else '<STR_LIT>'))<EOL>sub_ax.set_xticks([<NUM_LIT>, <NUM_LIT>])<EOL>sub_ax.set_xticklabels(('<STR_LIT:test>', '<STR_LIT>'))<EOL><DEDENT><DEDENT><DEDENT>plt.legend(loc=<NUM_LIT:6>, bbox_to_anchor=(<NUM_LIT>, <NUM_LIT:0.5>))<EOL>plt.tight_layout()<EOL>sub_ax = plt.subplot(<NUM_LIT:1>, n_subplots+<NUM_LIT:1>, n_subplots+<NUM_LIT:1>)<EOL>hid_bar = plt.bar(<NUM_LIT:1>, <NUM_LIT:100>)<EOL>for group in hid_bar:<EOL><INDENT>group.set_visible(False)<EOL><DEDENT>sub_ax.set_visible(False)<EOL>if livvkit.publish:<EOL><INDENT>plt.savefig(os.path.splitext(plot_file)[<NUM_LIT:0>]+'<STR_LIT>', dpi=<NUM_LIT>)<EOL><DEDENT>plt.savefig(plot_file)<EOL>plt.close()<EOL>return elements.image(title, description, os.path.basename(plot_file))<EOL>
Description

Args:
    timing_stats: a dictionary of the form
        {proc_count : {model||bench : { var : { stat : val }}}}
    scaling_var: the variable that accounts for the total runtime
    title: the title of the plot
    description: the description of the plot
    plot_file: the file to write the plot out to
Returns:
    an image element containing the plot file and metadata