title: How to preserve the resolution when adding axis using matplotlib.pyplot?
body: <p>If the following code is run</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  a=np.random.random((1000,1000))
  plt.imshow(a, cmap='Reds', interpolation='nearest')
  plt.savefig('fig.png',bbox_inches='tight')
  </code></pre>
  
  <p>I got the picture below, with all the cells representing each random number.</p>
  
  <p><a href="https://i.stack.imgur.com/G0Hjm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G0Hjm.png" alt="enter image description here"></a></p>
  
  <p>However, when the axis is added as the code shown below:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  a=np.random.random((1000,1000))
  plt.imshow(a, cmap='Reds', interpolation='nearest')
  
  plt.xlim(0, 10)
  plt.xticks(list(range(0, 10)))
  plt.ylim(0, 10)
  plt.yticks(list(range(0, 10)))
  
  plt.savefig('fig3.png',bbox_inches='tight')
  </code></pre>
  
  <p>I got the picture with less resolution:</p>
  
  <p><a href="https://i.stack.imgur.com/Ucsrt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ucsrt.png" alt="enter image description here"></a></p>
  
  <p>So how can I add axis ticks without affecting the resolution? If this is related to the font size of axis markers, how to automatically adjust them so as to keep the original resolution?</p>