Neural Sync Active
Animation and Interaction
Registry Synced
Animation and Interaction
75 words
1 min read
Reading compass
Now · Matplotlib Animation
Animation and Interaction
Matplotlib Animation
pythonimport matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation import numpy as np fig, ax = plt.subplots() x = np.linspace(0, 2*np.pi, 100) line, = ax.plot(x, np.sin(x)) def update(frame): line.set_ydata(np.sin(x + frame/10)) return line, ani = FuncAnimation(fig, update, frames=100, interval=50) plt.show()
Plotly Interactive Features
pythonimport plotly.graph_objects as go fig = go.Figure() fig.add_trace(go.Scatter(x=[1,2,3], y=[1,3,2], mode='lines+markers')) fig.update_layout( title="Interactive Plot", xaxis=dict(title="X"), yaxis=dict(title="Y"), hovermode='x' ) fig.show()