title: matplotlib bar chart: space out bars
body: <p>How do I increase the space between each bar with matplotlib barcharts, as they keep cramming them self to the centre.<a href="https://i.stack.imgur.com/oYxW1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oYxW1.png" alt="enter image description here"></a> (this is what it currently looks)</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import matplotlib.dates as mdates
  def ww(self):#wrongwords text file
  
      with open("wrongWords.txt") as file:
          array1 = []
          array2 = [] 
          for element in file:
              array1.append(element)
  
          x=array1[0]
      s = x.replace(')(', '),(') #removes the quote marks from csv file
      print(s)
      my_list = ast.literal_eval(s)
      print(my_list)
      my_dict = {}
  
      for item in my_list:
          my_dict[item[2]] = my_dict.get(item[2], 0) + 1
  
      plt.bar(range(len(my_dict)), my_dict.values(), align='center')
      plt.xticks(range(len(my_dict)), my_dict.keys())
  
      plt.show()
  </code></pre>