Create book_plots.py
This commit is contained in:
parent
df78983576
commit
e16af3c383
@ -528,20 +528,18 @@ def plot_track(xs, ys=None, label='Track', c='k', lw=2, **kwargs):
|
||||
|
||||
|
||||
def plot_filter(xs, ys=None, c='#013afe', label='Filter', var=None, **kwargs):
|
||||
#def plot_filter(xs, ys=None, c='#6d904f', label='Filter', vars=None, **kwargs):
|
||||
|
||||
|
||||
""" plot result of KF with color `c`, optionally displaying the variance
|
||||
of `xs`. Returns the list of lines generated by plt.plot()"""
|
||||
|
||||
if ys is None:
|
||||
ys = xs
|
||||
xs = range(len(ys))
|
||||
|
||||
retval = plt.plot(xs, ys, color=c, label=label, **kwargs)
|
||||
|
||||
lines = plt.plot(xs, ys, color=c, label=label, **kwargs)
|
||||
if var is None:
|
||||
return retval
|
||||
return lines
|
||||
|
||||
var = np.asarray(var)
|
||||
|
||||
std = np.sqrt(var)
|
||||
std_top = ys+std
|
||||
std_btm = ys-std
|
||||
@ -551,7 +549,7 @@ def plot_filter(xs, ys=None, c='#013afe', label='Filter', var=None, **kwargs):
|
||||
plt.fill_between(xs, std_btm, std_top,
|
||||
facecolor='yellow', alpha=0.2)
|
||||
|
||||
return retval
|
||||
return lines
|
||||
|
||||
|
||||
|
||||
@ -627,4 +625,4 @@ if __name__ == "__main__":
|
||||
'''p = [0.2245871, 0.06288015, 0.06109133, 0.0581008, 0.09334062, 0.2245871,
|
||||
0.06288015, 0.06109133, 0.0581008, 0.09334062]*2
|
||||
bar_plot(p)
|
||||
plot_measurements(p)'''
|
||||
plot_measurements(p)'''
|
||||
|
Loading…
Reference in New Issue
Block a user