Matplotlib动画:如何删除之前绘制的点?

我正在获取并绘制纬度和经度。我可以在绘图上对其进行动画处理,但我希望在绘制下一个点之前将之前绘制的点删除。另外,我如何中断动画并转到代码的其余部分(例如下面的elif语句)下面是我的代码结构:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from matplotlib import animation
fig=plt.figure(figsize=(10,8))
ax = plt.axes(projection=ccrs.PlateCarree())
ax.stock_img()
ax.gridlines(draw_labels=True, color='black', linestyle='-', alpha=0.2)


def calc(i)

#Here the latitude.degrees and longitude.degrees are calculated (acquired)

plt.scatter(longitude.degrees, latitude.degrees, color='Red', marker='o')


while True:


        if some condition:
          anim = animation.FuncAnimation(fig, calc, interval=100, blit=False)

          plt.show()

        elif some other condition: # I never get to this statement. If i close plot, the entire Gui 
                                   #closes

          some other code

window.close() # I am using pysimplegui

转载请注明出处:http://www.tzjx69597577.net/article/20230526/2572425.html