Skip to content

Instantly share code, notes, and snippets.

@LS80
Last active January 29, 2020 14:31
Show Gist options
  • Save LS80/dd1ec164d58bceca87e300c338f2c11e to your computer and use it in GitHub Desktop.
Save LS80/dd1ec164d58bceca87e300c338f2c11e to your computer and use it in GitHub Desktop.
import sys
import matplotlib.pyplot as plt
import matplotlib.animation as mani
import requests
import numpy as np
session = requests.Session()
fig, axarr = plt.subplots(3, sharex=True)
def animate(i):
resp = session.get(
'http://192.168.1.5:8080/xyz_{}.csv'.format(sys.argv[1]), stream=True).raw
x, y, z = np.loadtxt(resp, delimiter=',', unpack=True)
for axis in axarr:
axis.clear()
axarr[0].plot(x)
axarr[1].plot(y)
axarr[2].plot(z)
ani = mani.FuncAnimation(fig, animate, interval=100)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment