title: Cleanest way to set xtickslabel in specific position
body: <p>I want to plot a histogram with binned data.   </p>
  
  <h3>data</h3>
  
  <pre><code>## x_da: 1,2,3,4,5
  x_da = np.arange(1,1+5*1,1)
  ## bin setting 
  bin_range = ["&lt; 1 ","1 - 2","2 - 3","3 - 4","&gt; 4"]
  ## Counts base on the bin(Already st)
  y_da = np.array([178,2301,2880,1686,1715])      
  </code></pre>
  
  <h3>Plot</h3>
  
  <pre><code>fig = plt.figure(figsize= (5,3))
  ax = plt.subplot(111)  
  plt.bar(x_da,y_da,width=1,edgecolor='none',align='center', \
          fill=True,facecolor = "green",zorder = 1 ,alpha=0.5) 
  ax.get_yaxis().set_tick_params(which='both', direction='out')
  ax.get_xaxis().set_tick_params(which='both', direction='out')    
  
  ## Set the "range" mapping to its bar
  ax.set_xticks(np.arange(1,1+5*1,1))
  ax.set_xticklabels(bin_range,fontsize = 14)    
  </code></pre>
  
  <h3>Figure</h3>
  
  <p><a href="http://7xrn7f.com1.z0.glb.clouddn.com/16-3-9/18987922.jpg" rel="nofollow noreferrer">http://7xrn7f.com1.z0.glb.clouddn.com/16-3-9/18987922.jpg</a>    </p>
  
  <h3>My aim</h3>
  
  <blockquote>
    <ol>
    <li>adjust xtickslines' positions which represent the extension of bar vertical edges like follows:      </li>
    </ol>
  </blockquote>
  
  <p><a href="http://7xrn7f.com1.z0.glb.clouddn.com/16-3-9/5475187.jpg" rel="nofollow noreferrer">http://7xrn7f.com1.z0.glb.clouddn.com/16-3-9/5475187.jpg</a>      </p>
  
  <blockquote>
    <ol start="2">
    <li>the xticklabels still locate in the same position(midpoint of each bar)        </li>
    </ol>
  </blockquote>
  
  <h3>My attempt</h3>
  
  <p>My method was to creat a xticks contain those position above, and set the midpoint ones invisble.<br>
  With code like this:     </p>
  
  <pre><code>ax.set_xticks(np.arange(0.5,1+10*0.5,1))
  for xtick in ax.xaxis.get_ticklines()[1::2]:
      xtick.set_visible(False)     
  ax.set_xticklabels(bin_range,fontsize = 14)
  </code></pre>
  
  <p><a href="http://7xrn7f.com1.z0.glb.clouddn.com/16-3-9/78024677.jpg" rel="nofollow noreferrer">http://7xrn7f.com1.z0.glb.clouddn.com/16-3-9/78024677.jpg</a>      </p>
  
  <p>The "invisible" approach has solved the issue in an easy way, but the xticklabels' position has changed too.    </p>
  
  <p>I don't want to add some " "(empty string) to the bin_range in order to jump one xtickline. Can someone offer some advice to solve this problem in the cleanest way?     </p>