title: change the position (move) of tick labels when plotting with matplotlib
body: <p>i am plotting with matplotlib. the code is the following (zvals has the values)</p>
  
  <pre><code>cmap = mpl.colors.ListedColormap(['darkblue', 'blue', 'lightblue','lightgreen','yellow','gold','orange','darkorange','orangered','red'])
  bounds=[0, 10,20,30,40,50,60,70,80,100,200,1000]
  norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
  img2 = plt.imshow(zvals,interpolation='nearest',
                  cmap = cmap,
                  norm=norm,
                  origin='lower')
  
  
  xlocations = na.array(range(30)) + 0.5
  xticks(xlocations, [str(x+1) for x in arange(30)], rotation=0, size=5)
  gca().xaxis.set_ticks_position('none')
  gca().yaxis.set_ticks_position('none')  
  grid(True)
  </code></pre>
  
  <p>this results in the following picture:
  <a href="http://imageshack.us/a/img145/7325/histogrammoverview.png" rel="nofollow">http://imageshack.us/a/img145/7325/histogrammoverview.png</a></p>
  
  <p>i would like to move the labels of the xticks (1,2,3,..) to the left a bit, so they are underneath the corresponding color boxes. correspondingly i would also like to move the labels of the yticks (user1 and user2) down a bit so they are displayed correctly. how can this be done?</p>
  
  <p>EDIT: as a matter of fact i could change the following line
      xlocations = na.array(range(30)) + 0.5
  to
      xlocations = na.array(range(30))</p>
  
  <p>then the resulting pictures is like this:
  <a href="http://imageshack.us/a/img338/7325/histogrammoverview.png" rel="nofollow">http://imageshack.us/a/img338/7325/histogrammoverview.png</a></p>
  
  <p>please see that the grid is going "through" the colored boxes, which is not what i want. i'd like the grid to edge the colored boxes as in the above picture. in this version though the labels (1,2,3,...) are placed correctly underneath the boxes. how can i have correctly places labels (underneath the colored boxes) and a grid which is around the colored boxes and not through the middle of the colored boxes.</p>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>this solution works (as suggested by the answer):</p>
  
  <pre><code>periods = 30
  xlocations = na.array(range(periods))
  xminorlocations = na.array(range(periods))+0.5
  xticks(xlocations, [str(x+1) for x in arange(periods)], rotation=0, size=5)
  plt.set_xticks(xminorlocations, minor=True)
  grid(True, which='minor', linestyle='-')
  </code></pre>
  
  <p>result: hxxp://imageshack.us/a/img9/7325/histogrammoverview.png</p>