Skeleton with interactive plotting

release/4.3a0
Frank 2016-01-26 13:19:25 -08:00
parent 6d5ca7e546
commit a126c91d6f
1 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
"""
A script validating the ImuFactor prediction and inference.
"""
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
class ImuFactorExample(object):
def __init__(self):
plt.figure(1)
plt.ion()
def plot(self):
times = np.arange(0, 10, 0.1)
shape = len(times), 1
labels = list('xyz')
colors = list('rgb')
plt.clf()
for row, (label, color) in enumerate(zip(labels, colors)):
plt.subplot(3, 1, row)
imu = np.random.randn(len(times), 1)
plt.plot(times, imu, color=color)
# plt.axis([tmin, tmax, min,max])
plt.xlabel(label)
plt.pause(0.1)
def run(self):
for i in range(100):
self.plot()
if __name__ == '__main__':
ImuFactorExample().run()