def plot_summary_figure(info_df, summary_df, color_list, symbol_list,
                        selected_summaries,
                        batch_dir, batch_name, plot_style=None, show=False,
                        save=True,
                        figure_type=None):
    """Create a figure with summary graphs.
    Args:
        info_df: the pandas DataFrame with info about the runs.
        summary_df: a pandas DataFrame with the summary data.
        color_list: a list of colors to use (one pr. group)
        symbol_list: a list of symbols to use (one pr. cell in largest group)
        selected_summaries: a list of the selected summaries to plot
        batch_dir: path to the folder where the figure should be saved.
        batch_name: the batch name.
        plot_style: the matplotlib plot-style to use.
        show: show the figure if True.
        save: save the figure if True.
        figure_type: a string for selecting type of figure to make.
    """
    figure_type_object = figure_types[figure_type]

    logger.debug("creating figure ({})".format(figure_type))
    standard_fig, ax = plt.subplots(nrows=figure_type_object.rows,
                                    ncols=figure_type_object.columns,
                                    sharex=True)

    ce_ax = figure_type_object.retrieve_axis("ce_ax", ax)
    cap_ax = figure_type_object.retrieve_axis("cap_ax", ax)
    ir_ax = figure_type_object.retrieve_axis("ir_ax", ax)
    ev_ax = figure_type_object.retrieve_axis("ev_ax", ax)

    # pick data (common for all plot types)
    # could include a if cd_ax: pick_summary_data...
    ce_df = pick_summary_data("coulombic_efficiency", summary_df,
                              selected_summaries)
    cc_df = pick_summary_data("charge_capacity", summary_df, selected_summaries)
    dc_df = pick_summary_data("discharge_capacity", summary_df,
                              selected_summaries)

    # generate labels
    ce_labels = [info_df.get_value(filename, "labels") for filename in
                 ce_df.columns.get_level_values(0)]

    # adding charge/discharge label
    ce_labels.extend(["", "discharge", "charge"])

    # plot ce
    list_of_lines, plot_style = plot_summary_data(ce_ax, ce_df, info_df=info_df,
                                                  color_list=color_list,
                                                  symbol_list=symbol_list,
                                                  is_charge=False,
                                                  plot_style=plot_style)
    ce_ax.set_ylabel("Coulombic\nefficiency\n(%)")
    ce_ax.locator_params(nbins=5)

    # adding charge/discharge label
    color = plot_style["color"]
    markersize = plot_style["markersize"]

    open_label = mpl.lines.Line2D([], [], color=color, marker='s',
                                  markeredgecolor=color, markerfacecolor='none',
                                  markersize=markersize)
    closed_label = mpl.lines.Line2D([], [], color=color, marker='s',
                                    markeredgecolor=color,
                                    markerfacecolor=color,
                                    markersize=markersize)
    no_label = mpl.lines.Line2D([], [], color='none', marker='s', markersize=0)
    list_of_lines.extend([no_label, closed_label, open_label])

    # plotting capacity (common)
    plot_summary_data(cap_ax, cc_df, is_charge=True, info_df=info_df,
                      color_list=color_list,
                      symbol_list=symbol_list, plot_style=plot_style)
    plot_summary_data(cap_ax, dc_df, is_charge=False, info_df=info_df,
                      color_list=color_list,
                      symbol_list=symbol_list, plot_style=plot_style)
    cap_ax.set_ylabel("Capacity\n(mAh/g)")
    cap_ax.locator_params(nbins=4)

    # plotting ir data (common)
    plot_ir_charge, plot_ir_discharge = figure_type_object.ir_selector
    if plot_ir_charge:
        irc_df = pick_summary_data("ir_charge", summary_df, selected_summaries)
        plot_summary_data(ir_ax, irc_df, is_charge=True, info_df=info_df,
                          color_list=color_list,
                          symbol_list=symbol_list, plot_style=plot_style)
    if plot_ir_discharge:
        ird_df = pick_summary_data("ir_discharge", summary_df,
                                   selected_summaries)
        plot_summary_data(ir_ax, ird_df, is_charge=False, info_df=info_df,
                          color_list=color_list,
                          symbol_list=symbol_list, plot_style=plot_style)

    ir_ax.set_ylabel("Internal\nresistance\n(Ohms)")
    ir_ax.set_xlabel("Cycle number")
    ir_ax.locator_params(axis="y", nbins=4)
    ir_ax.locator_params(axis="x", nbins=10)
    # should use MaxNLocator here instead

    # pick data (not common for all plot types)
    if ev_ax is not None:
        plot_ev_charge, plot_ev_discharge = figure_type_object\
            .end_voltage_selector
        if plot_ev_charge:
            evc_df = pick_summary_data("end_voltage_charge", summary_df,
                                       selected_summaries)
            plot_summary_data(ev_ax, evc_df, is_charge=True, info_df=info_df,
                              color_list=color_list,
                              symbol_list=symbol_list, plot_style=plot_style)
        if plot_ev_discharge:
            evd_df = pick_summary_data("end_voltage_discharge", summary_df,
                                       selected_summaries)
            plot_summary_data(ev_ax, evd_df, is_charge=False, info_df=info_df,
                              color_list=color_list,
                              symbol_list=symbol_list, plot_style=plot_style)

        ev_ax.set_ylabel("End\nvoltage\n(V)")
        ev_ax.locator_params(axis="y", nbins=4)

    # tweaking
    plt.subplots_adjust(left=0.07, right=0.93, top=0.9, wspace=0.25,
                        hspace=0.15)

    # adding legend
    logger.debug("trying to add legends " + str(ce_labels))
    standard_fig.legend(handles=list_of_lines, labels=ce_labels,
                        bbox_to_anchor=(1.02, 1.1), loc=2,
                        # bbox_transform=plt.gcf().transFigure,
                        bbox_transform=ce_ax.transAxes,
                        numpoints=1,
                        ncol=1, labelspacing=0.,
                        prop={"size": 10})

    # plt.tight_layout()
    if save:
        extension = prms.Batch["fig_extension"]
        dpi = prms.Batch["dpi"]
        figure_file_name = os.path.join(batch_dir, "%splot_%s.%s" % (
        figure_type, batch_name, extension))
        standard_fig.savefig(figure_file_name, dpi=dpi, bbox_inches='tight')
    if show:
        plt.show()
    return standard_fig, (ce_ax, cap_ax, ir_ax)
Create a figure with summary graphs.
    Args:
        info_df: the pandas DataFrame with info about the runs.
        summary_df: a pandas DataFrame with the summary data.
        color_list: a list of colors to use (one pr. group)
        symbol_list: a list of symbols to use (one pr. cell in largest group)
        selected_summaries: a list of the selected summaries to plot
        batch_dir: path to the folder where the figure should be saved.
        batch_name: the batch name.
        plot_style: the matplotlib plot-style to use.
        show: show the figure if True.
        save: save the figure if True.
        figure_type: a string for selecting type of figure to make.