aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Garlick <pgarlick@tourbillion-technology.com>2021-12-20 17:59:39 +0000
committerPaul Garlick <pgarlick@tourbillion-technology.com>2021-12-20 17:59:39 +0000
commitd0f64e2041728634b185fcd46497ec93973c2057 (patch)
tree75eb3550a0bf9d8297f9a6a08ba3134f29805943
parent8c55c82eff9caf89a39e789de2d585efde3478a4 (diff)
downloadfullSWOF-utils-d0f64e2041728634b185fcd46497ec93973c2057.tar.gz
specificPoints.py: Enable live plot updates.
* fullswof-utils/specificPoints.py: Add on_press() function.
-rwxr-xr-xfullswof-utils/specificPoints.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/fullswof-utils/specificPoints.py b/fullswof-utils/specificPoints.py
index 03bdfe7..0f27911 100755
--- a/fullswof-utils/specificPoints.py
+++ b/fullswof-utils/specificPoints.py
@@ -3,17 +3,32 @@
import matplotlib.pyplot as plt
import numpy as np
import os
+import sys
from matplotlib.ticker import MultipleLocator
def detach_display():
+ fig, ax = plt.subplots()
t, x, y, h, u, v = np.loadtxt(
'hu_specific_points.dat', delimiter='\t', unpack=True)
- fig, ax = plt.subplots()
- plt.plot(t,h, label='elevation')
plt.xlabel('time / s')
plt.ylabel('water height / m')
- ax.yaxis.set_minor_locator(MultipleLocator(0.2))
- plt.grid(True, which='minor')
+ plt.plot(t,h, label='elevation')
+ #ax.yaxis.set_minor_locator(MultipleLocator(200))
+ #plt.grid(True, which='minor')
+
+ def on_press(event):
+ #print('press', event.key)
+ #sys.stdout.flush()
+ if event.key == 'x':
+ plt.clf()
+ t, x, y, h, u, v = np.loadtxt(
+ 'hu_specific_points.dat', delimiter='\t', unpack=True)
+ plt.xlabel('time / s')
+ plt.ylabel('water height / m')
+ plt.plot(t,h, label='elevation')
+ fig.canvas.draw()
+ fig.canvas.mpl_connect('key_press_event', on_press)
+
plt.show()
if os.fork():