This repository has been archived on 2020-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
tpmni/3/test_plot.py

48 lines
985 B
Python

import numpy as np
import matplotlib.pyplot as plt
from time import sleep
# internet
# import matplotlib.pyplot as plt
# import numpy as np
# x = np.linspace(0, 6*np.pi, 100)
# y = np.sin(x)
# # You probably won't need this if you're embedding things in a tkinter plot...
# plt.ion()
# fig = plt.figure()
# ax = fig.add_subplot(111)
# line1, = ax.plot(x, y, 'r-') # Returns a tuple of line objects, thus the comma
# for phase in np.linspace(0, 10*np.pi, 500):
# line1.set_ydata(np.sin(x + phase))
# fig.canvas.draw()
# fig.canvas.flush_events()
# fin internet
x = np.arange(0, 10, 0.01)
y = np.cos(x)
plt.ion()
fig = plt.figure()
ax = fig.add_subplot(111)
# l1 = ax.plot(x, y)[0]
l = ax.plot(x, y)[0]
ax.set_xlim(0, 10)
ax.set_ylim(-2, 10)
arr = ax.arrow(0, 0, 0, 0)
for i in range(10):
arr.remove()
# plt.clf()
l.set_ydata(np.cos(x+i))
arr = ax.arrow(i, 0, 1, 1)
fig.canvas.draw()
fig.canvas.flush_events()
sleep(1)
# ax = plt.axes()