我該如何刪除這些白色邊框?爲什麼軸從-100開始,-100?最後,我如何設置最終的PNG圖像的大小?刪除白色邊框並設置最終圖像尺寸matplotlib
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
im = plt.imread('pitch.png')
implot = plt.imshow(im, aspect='auto')
dpi=96
if dpi is None:
dpi = matplotlib.rcParams['savefig.dpi']
dpi = float(dpi)
fig = plt.figure(figsize=(620/dpi, 579/dpi), dpi=dpi)
ax = fig.add_axes([0, 0, 1, 1], frame_on=False)
ax.imshow(im, interpolation='none')
x, y = np.genfromtxt('coords.csv', delimiter=',', unpack=True)
plt.plot(x,y, "o")
plt.savefig('dybala.png', bbox_inches='tight')