Answers for "interactive plot matplotlib"

0

matplotlib plot interactive

# Note: plot will be frozen when running with python console
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use("TkAgg")
import numpy as np

x = np.linspace(0, 6*np.pi, 100)
y = np.sin(x)

plt.ion()

fig = plt.figure()
ax = fig.add_subplot(111)
line1, = ax.plot(x, y, 'r-')
plt.draw()  # the line can be deleted

for phase in np.linspace(0, 10*np.pi, 500):
    line1.set_ydata(np.sin(x + phase))
    plt.draw()
    plt.pause(0.02)

plt.ioff()
plt.show()
Posted by: Guest on December-02-2020
0

interactive plots python

# Standard plotly importsimport plotly.plotly as pyimport plotly.graph_objs as gofrom plotly.offline import iplot, init_notebook_mode# Using plotly + cufflinks in offline modeimport cufflinkscufflinks.go_offline(connected=True)init_notebook_mode(connected=True)
Posted by: Guest on March-03-2021

Code answers related to "interactive plot matplotlib"

Python Answers by Framework

Browse Popular Code Answers by Language