results["title"].append(title) print def cm2inch(value): return value/2.54 def plot(): fig = plt.figure(figsize=(cm2inch(13), cm2inch(6))) ax = fig.add_subplot(111) bp = ax.boxplot(results["data"]) plt.setp(bp['boxes'], color='black') plt.setp(bp['whiskers'], color='black') plt.setp(bp['fliers'], color='black', marker='+') plt.setp(bp['medians'], color='black') ax.set_xticklabels(results["title"]) ax.set_ylim(0, np.max(results["data"])) ax.set_ylabel("Occupancy") plt.savefig('out/binam_occupancy_data.pdf', format='pdf', bbox_inches='tight') calculate(lambda: binam_data.generate_random(n_bits, n_ones, n_samples), "Random\n(with duplicates)") calculate(lambda: binam_data.generate(n_bits, n_ones, n_samples, balance=False), "Random\n(no duplicates)") calculate(lambda: binam_data.generate_naive(n_bits, n_ones, n_samples), "Balanced\n(with duplicates)") calculate(lambda: binam_data.generate(n_bits, n_ones, n_samples), "Balanced\n(no duplicates)") plot()
def cm2inch(value): return value / 2.54 def plot(): fig = plt.figure(figsize=(cm2inch(13), cm2inch(6))) ax = fig.add_subplot(111) bp = ax.boxplot(results["data"]) plt.setp(bp['boxes'], color='black') plt.setp(bp['whiskers'], color='black') plt.setp(bp['fliers'], color='black', marker='+') plt.setp(bp['medians'], color='black') ax.set_xticklabels(results["title"]) ax.set_ylim(0, np.max(results["data"])) ax.set_ylabel("Occupancy") plt.savefig('out/binam_occupancy_data.pdf', format='pdf', bbox_inches='tight') calculate(lambda: binam_data.generate_random(n_bits, n_ones, n_samples), "Random\n(with duplicates)") calculate( lambda: binam_data.generate(n_bits, n_ones, n_samples, balance=False), "Random\n(no duplicates)") calculate(lambda: binam_data.generate_naive(n_bits, n_ones, n_samples), "Balanced\n(with duplicates)") calculate(lambda: binam_data.generate(n_bits, n_ones, n_samples), "Balanced\n(no duplicates)") plot()