Im plotting some lines over a bitmap image in matplotlib. How do I make the image output by savefig the same size as the original image? I have the following code, but it still gives me a white border on the left and bottom, and the image is more than 100x100 pixels.
You can %paste
the code below to see what I mean:
import matplotlib.pyplot as plt
import numpy as np
plt.figure()
plt.imshow(np.eye(100))
plt.plot([1, 10, 20, 30, 40], [5, 100, 5, 100, 3], lw=3)
plt.ylim(0,100)
plt.xlim(0,100)
plt.axis('off')
plt.savefig('test.png', bbox_inches='tight', pad_inches=0)