Код: Выделить всё
import matplotlib.pyplot as plt, numpy as np
fig, ax = plt.subplots()
plt.tight_layout(pad=0.01)
fig.canvas.manager.full_screen_toggle()
img = np.random.randint(5, size=(4, 3))
while True:
ax.imshow(img)
print(fig.get_size_inches(), *ax.get_xlim())
plt.waitforbuttonpress()
Код: Выделить всё
[6.4 4.8] 0.0 1.0

он выводит физически правильные значения:
Код: Выделить всё
[12. 15.58] -0.5 2.5
Подробнее здесь: https://stackoverflow.com/questions/798 ... lib-script
Мобильная версия