python卸载matplotlib_如何删除matplotlib、Python中的上一个图形?

我运行了3个Python脚本,每个脚本在绘图中生成了一条曲线。在

每条曲线由数百条小线段组成。在

因此,每条曲线都是由一系列plot()绘制的,而不是一条。在

但是所有这些plot()共享相同的参数(例如,一条曲线的颜色、样式是一致的)。在

因此,我认为仍然可以轻松地删除由特定脚本绘制的所有片段。在

我发现最近运行的脚本生成的曲线是错误的。因此,我希望删除它。但同时,我不能仅仅关上窗户重新画出所有的东西。我希望保留所有其他曲线。在

我该怎么做?在

更新:绘制代码for i, position in enumerate(positions):

if i == 0:

plt.plot([0,0], [0,0], color=COLOR, label=LABEL)

else:

plt.plot([positions[i - 1][0], position[0]], [positions[i - 1][1], position[1]], STYLE, color=COLOR)

#plt.plot([min(np.array(positions)[:,0]), max(np.array(positions)[:,0])], [0,0], color='k', label='East') # West-East

#plt.plot([0,0], [min(np.array(positions)[:,1]), max(np.array(positions)[:,1])], color='k', label='North') # South-North

plt.gca().set_aspect('equal', adjustable='box')

plt.title('Circle Through the Lobby 3 times', fontsize=18)

plt.xlabel('x (m)', fontsize=16)

plt.ylabel('y (m)', fontsize=16)

plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))

plt.draw()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值