title: Different rotations for tick labels in matplotlib.pyplot
body: <p>I'm just trying to set different rotations for the x axis tick labels of a <code>pyplot</code> figure.</p>
  
  <p>Lets take this exemple :</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  x=np.arange(0,5)
  y=np.arange(0,5)
  
  plt.xlim(0,4)
  plt.ylim(0,4)
  
  plt.plot(x,y)
  
  plt.plot((1,1),(0,4),color='red',lw=1)
  plt.plot((2,2),(0,4),color='red',lw=1)
  plt.plot((2.98,2.98),(0,4),color='red',lw=1)
  plt.plot((3,3),(0,4),color='red',lw=1)
  
  lab_ticks=['Label 1','Label 2','Label 3','Label 4']
  x_ticks=[1,2,2.98,3]
  
  plt.xticks(x_ticks,lab_ticks,rotation=90)
  
  plt.savefig('im1.png')
  
  plt.show()
  </code></pre>
  
  <p>This code give us the following figure :</p>
  
  <p><a href="https://i.stack.imgur.com/9PzSX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9PzSX.png" alt="Image 1"></a></p>
  
  <p>My problem isn't that entire labels are not shown, I know how to fix it. My problem is that <code>Label 3</code> and <code>Label 4</code> are too much nearby and they overlap each other.</p>
  
  <p>I want to set the <code>rotation</code> of <code>Label 3</code> at <code>45</code> and the others at <code>90</code>, but when I tried to separate my <code>lab_ticks</code> and <code>x_ticks</code>, only the last <code>plt.xticks()</code> is shown : </p>
  
  <pre><code>lab_ticks=['Label 1','Label 2','Label 4']
  x_ticks=[1,2,3]
  
  lab_ticks2=['Label 3']
  x_ticks2=[2.98]
  
  plt.xticks(x_ticks,lab_ticks,rotation=90)
  plt.xticks(x_ticks2,lab_ticks2,rotation=45,ha='right')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/dtLjz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dtLjz.png" alt="enter image description here"></a></p>
  
  <p>Does anyone has a trick to fix that problem ?</p>
  
  <p>Thanks in advance !</p>
  
  <p>Smich</p>