How can I remove points from a matplotlib plot before plotting a new one?
问题 I am trying to plot a point whose position is controlled by a slider. However, each time the slider is moved a new point is plotted without deleting the old one. How do you remove the old point before the new one is plotted? from mpl_toolkits.mplot3d import Axes3D from matplotlib import pyplot from matplotlib import pyplot as plt from matplotlib.widgets import Slider def on_change(val): point=ax.scatter(x[int(val)/1],y[int(val)/1],z[int(val)/1]) x=[0,0.5,1] y=[0,0.5,1] z=[0,0.5,1] p=0 fig =