Вот один из способов с matplotlib: FuncAnimation
# set up data
data = pd.DataFrame({0:np.linspace(-1,1,101)})
# function values
data[1] = data[0]**2
# rotation matrix
alpha = np.deg2rad(15)
rot_mat = np.array([[np.cos(alpha), -np.sin(alpha)],[np.sin(alpha), np.cos(alpha)]])
# set up plots
fig, ax = plt.subplots(figsize=(6,6))
ln, = plt.plot([],[], 'r')
# set up animation
def init():
ax.set_xlim(-1,1)
ax.set_ylim(-1,1)
return ln,
def update(frame):
global data
data = (rot_mat @ data.T).T
ln.set_data(data[0], data[1])
return ln,
# init animation
anim = FuncAnimation(fig, update, frames=np.arange(100),
init_func=init, blit=True)
plt.plot()
Вывод:
![enter image description here](https://i.stack.imgur.com/CQoVg.gif)