我运行了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()