matplotlib: Stretch image to cover the whole figure
问题 I am quite used to working with matlab and now trying to make the shift matplotlib and numpy. Is there a way in matplotlib that an image you are plotting occupies the whole figure window. import numpy as np import matplotlib.pyplot as plt # get image im as nparray # ........ plt.figure() plt.imshow(im) plt.set_cmap('hot') plt.savefig("frame.png") I want the image to maintain its aspect ratio and scale to the size of the figure ... so when I do savefig it exactly the same size as the input