title: How to make axes ticks in between grid lines in matplotlib?
body: <p>In my simple example below, how to make x-axis tick values to appear between grids?</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  np.random.seed(1)
  x = range(10)
  y = np.random.random(10)
  plt.plot(x,y)
  plt.xticks(x)
  plt.grid(True)
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/qzBmz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qzBmz.png" alt="enter image description here"></a></p>
  
  <p>The following make ticks to be where I want but the grid lines also moves. </p>
  
  <pre><code>np.random.seed(1)
  x = range(10)
  y = np.random.random(10)
  plt.plot(x,y)
  plt.xticks(x)
  plt.grid(True)
  plt.xticks(np.arange(10)+0.5, x)
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/do6P4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/do6P4.png" alt="enter image description here"></a></p>
  
  <p>I would like the result to be:
  <a href="https://i.stack.imgur.com/xvfug.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xvfug.png" alt="enter image description here"></a></p>