title: Boxplots equally spread out
body: <p>I would like to spread my boxplots equally over the x-axis. The following code generates a figure where the two boxplots are close with plenty of space on either side. In generate I want the code to spread the boxplots out evenly regardless of the number of boxplots (in this example there are only two, but in general there will be many). </p>
  
  <pre><code>import matplotlib.pyplot as plt
  
  statistic_dict = {0.40000000000000002: [0.36003616645322273, 0.40526649416305677, 0.46522159350924536], 0.20000000000000001: [0.11932912803730165, 0.23235825966896217, 0.12380728472472625]}
  
  def draw_boxplot(y_values, x_values, edge_color, fill_color):
      bp = plt.boxplot(y_values, patch_artist=True, positions=x_values)
      for element in ['boxes', 'whiskers', 'fliers', 'medians', 'caps']:
          plt.setp(bp[element], color=edge_color)
      plt.xlabel("x label ")
      plt.ylabel("y label ")
      plt.title("Title")
      for patch in bp['boxes']:
          patch.set(facecolor=fill_color)
  
  
  y_values = statistic_dict.values()
  x_values = statistic_dict.keys()
  draw_boxplot(y_values, x_values, "skyblue", "white")
  plt.savefig('fileName.png', bbox_inches='tight')
  plt.close()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/QWO4E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QWO4E.png" alt="enter image description here"></a></p>