title: Plotting a 2D line over a figure 2D line in matplotlib
body: <p>I'm trying to plot a line over a figure line but couldn't plot it exactly on the axes. You can find the code here:</p>
  <p><a href="https://colab.research.google.com/drive/1J12vWUIUr0dDIesMHBU9vYUkjnNKXOqT?usp=sharing" rel="nofollow noreferrer">https://colab.research.google.com/drive/1J12vWUIUr0dDIesMHBU9vYUkjnNKXOqT?usp=sharing</a></p>
  <p>Here is the code for the 2D line which is then saved.</p>
  <pre><code>ax = plt.subplot()
  ax.plot([10,45], [20,100], color=&quot;g&quot;)
  
  plt.xticks([])
  plt.yticks([])
  ax.set_axis_off()
  plt.axis([0, 144, 0, 144])
  plt.figure(figsize = (2,2))
  plt.tight_layout()
  plt.show()
  fig.savefig('testfig.png')
  </code></pre>
  <p><a href="https://i.stack.imgur.com/mqVu6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mqVu6.png" alt="ground truth" /></a></p>
  <p>Here is the code where I import the figure line and create a similar line with exact same coordinates and axes but couldn't figure it out. Green line is the imported one and the red one is the line to draw exactly over the imported one.</p>
  <pre><code>image = plt.imread('testfig.png')
  #fig2 = plt.figure()
  #fig2.set_size_inches(1,1)
  ax2 = plt.subplot()
  ax2.imshow(image, extent=[0, 144, 0, 144])
  
  ax2.plot([10,45], [20,100], color=&quot;r&quot;)
  plt.xticks([])
  plt.yticks([])
  ax2.set_axis_off()
  plt.tight_layout()
  plt.axis([0, 144, 0, 144])
  plt.figure(figsize = (2,2))
  print(image.shape)
  
  plt.show()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/xALpn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xALpn.png" alt="2 lines" /></a></p>
  <p>Maybe it's because the exported line's shape comes out different from what I intended i.e 144x144. Is there a way to export exactly 144x144 without reshaping?</p>