Python matplotlib动画周围的空白

Python matplotlib动画周围的空白,python,animation,matplotlib,plot,jupyter-notebook,Python,Animation,Matplotlib,Plot,Jupyter Notebook,我是一个真正的python新手,似乎无法让这个动画看起来像我想要的那样。我制作了一个类似的没有动画的情节,它很好地出现在Jupyter笔记本中,只有很少的空白。然而,当我在情节中添加动画时,它看起来真的很难看!这是我的密码: %%capture %matplotlib inline import matplotlib.animation as animation plt.rcParams["animation.html"] = "jshtml" fig = plt.figure(figsize

我是一个真正的python新手,似乎无法让这个动画看起来像我想要的那样。我制作了一个类似的没有动画的情节,它很好地出现在Jupyter笔记本中,只有很少的空白。然而,当我在情节中添加动画时,它看起来真的很难看!这是我的密码:

%%capture
%matplotlib inline
import matplotlib.animation as animation
plt.rcParams["animation.html"] = "jshtml"

fig = plt.figure(figsize=(11, 9))

# Set map area and set to display coastlines, country borders etc.
ax = plt.axes([0, 0, 0.99, 0.99], projection=ccrs.PlateCarree())
ax.set_extent([-130, -10, 0, 40], ccrs.Geodetic())
ax.background_patch.set_visible(False)
ax.outline_patch.set_visible(True)
ax.add_feature(cfeature.LAND, facecolor='whitesmoke')
ax.coastlines()
ax.add_feature(cfeature.BORDERS)

# selects which data to plot, from larger dataframe
gd = (df_plot.Name == "IRMA")
Long_vals = df_plot.loc[gd,'Long'].values
Lat_vals = df_plot.loc[gd,'Lat'].values
data = np.array([Long_vals,Lat_vals])

# set up empty plot
l, = ax.plot([], [], c='red')

# define how to add points to plot in animation
def update_track(num, data, line):
    line.set_data(data[..., :num])
    return line,

anim = animation.FuncAnimation(fig, update_track, fargs=(data, l),
                               frames=60, interval=50, 
                               blit=True, repeat=False)
目前,我的情节的底部是这样的。。。顶部和侧面的空白量相似。我可以让它与笔记本的其他部分更齐平吗?谢谢