def plot_precision_vs_bin_size(pd_bins, output_dir):
    pd_plot = pd_bins[pd_bins[utils_labels.TOOL] != utils_labels.GS]

    for tool_label, pd_tool in pd_plot.groupby(utils_labels.TOOL):
        fig, axs = plt.subplots(figsize=(5, 4.5))
        axs.scatter(np.log(pd_tool['total_length']), pd_tool['precision_bp'], marker='o')

        axs.set_xlim([None, np.log(pd_tool['total_length'].max())])
        axs.set_ylim([0.0, 1.0])
        axs.set_title(tool_label, fontsize=12)

        plt.ylabel('Purity per bin (%)', fontsize=12)
        plt.xlabel('Bin size [log(# bp)]', fontsize=12)

        fig.savefig(os.path.join(output_dir, 'genome', tool_label, 'purity_vs_bin_size.png'), dpi=200, format='png', bbox_inches='tight')
        plt.close(fig)