I would like to make a boxplot using two data sets. Each set is a list of floats. A and B are examples of the two data sets
A = []
B = []for i in xrange(10):l = [random.random() for i in xrange(100)]m = [random.random() for i in xrange(100)]A.append(l)B.append(m)
I would like the boxplots for A and B to appear next to each other, not on each other. Also, I would like more gap between the different x-values and perhaps thinner boxes. My code is below and so is the plot it produces (the present code puts A on top of B). Thanks for helping.
def draw_plot(data, edge_color, fill_color):bp = ax.boxplot(data, patch_artist=True)for element in ['boxes', 'whiskers', 'fliers', 'medians', 'caps']:plt.setp(bp[element], color=edge_color)plt.xticks(xrange(11))for patch in bp['boxes']:patch.set(facecolor=fill_color)fig, ax = plt.subplots()
draw_plot(A, "tomato", "white")
draw_plot(B, "skyblue", "white")
plt.savefig('sample_box.png', bbox_inches='tight')
plt.close()