title: Python Matplotlib: plotting histogram with overlapping boundaries removed
body: <p>I am plotting a histogram using Matplotlib in Python with the <code>matplotlib.bar()</code> function.  This gives me plots that look like this:</p>
  
  <p><a href="https://i.stack.imgur.com/yj7Dm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yj7Dm.png" alt="enter image description here"></a></p>
  
  <p>I am trying to produce a histogram that only plots the caps of each bar and the sides that don't directly share space with the border of another bar, more like this: (I edited this using gimp)</p>
  
  <p><a href="https://i.stack.imgur.com/tn9YS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tn9YS.png" alt="enter image description here"></a></p>
  
  <p>How can I achieve this using Python?  Answers using <code>matplotlib</code> are preferable since that is what I have the most experience with but I am open to anything that works using Python.</p>
  
  <p>For what it's worth, here's the relevant code:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as pp
  
  bin_edges, bin_values = np.loadtxt("datafile.dat",unpack=True)
  bin_edges = np.append(bin_edges,500.0)
  
  bin_widths = []
  for j in range(len(bin_values)):
      bin_widths.append(bin_edges[j+1] - bin_edges[j])
  
  pp.bar(bin_edges[:-1],bin_values,width=bin_widths,color="none",edgecolor='black',lw=2)
  
  
  pp.savefig("name.pdf")
  </code></pre>