title: How to plot and save an image using python just like in matlab?
body: <p>I have a code in Matlab which reads data from a txt file and, after some manipulations with that data, generates a 20x20 array that is used to plot an image as follows:
  <img src="https://i.stack.imgur.com/CqKeB.jpg" alt=""></p>
  
  <p>I needed to transcribe this code to Python for reasons of optimization and project need. Until the phase of generating the matrix is correct, but I can not generate the same images, because they are with different scales and colors as follows:
  <img src="https://i.stack.imgur.com/B2Y5F.jpg" alt=""></p>
  
  <p>The following is the code snippet in Matlab that plots the image:</p>
  
  <pre><code>figure
  image(H1,'CDataMapping','scaled')
  colormap;
  saveas(gcf,'d1.jpg');
  </code></pre>
  
  <p>And here's the code snippet in Python:</p>
  
  <pre><code>import matplotlib.pylab as plt
  fig, ax = plt.subplots()
  ax.imshow(H1)
  plt.gcf().savefig('d1.jpg')
  plt.show()
  plt.close()
  </code></pre>
  
  <p>I just need to plot the image with the same resolution (875 x 656) and change the color to be more similar.</p>
  
  <p>Right now, I thank those who help! :D</p>