Skip to content

Commit e7c0cdb

Browse files
committed
Fix type errors
1 parent f4c7726 commit e7c0cdb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

yamcs-client/examples/plot_with_matplotlib.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from datetime import datetime, timedelta, timezone
22

3+
import matplotlib.dates as mdates
34
import matplotlib.pyplot as plt
45
from yamcs.client import YamcsClient
56

@@ -13,9 +14,13 @@
1314
samples = archive.downsample_mean("/YSS/SIMULATOR/Altitude", start=start, stop=stop)
1415
x = [s.time for s in samples]
1516
y = [s.avg for s in samples]
17+
18+
mx = [mdates.date2num(t) for t in x]
19+
my = [val if val is not None else float("nan") for val in y]
20+
1621
plt.subplot(2, 1, 1)
1722
plt.title("Sampled at " + str(stop))
18-
plt.plot(x, y)
23+
plt.plot(mx, my)
1924
plt.xlim(start, stop)
2025
plt.ylabel("Altitude")
2126
plt.grid()
@@ -24,8 +29,12 @@
2429
samples = archive.downsample_mean("/YSS/SIMULATOR/SinkRate", start=start, stop=stop)
2530
x = [s.time for s in samples]
2631
y = [s.avg for s in samples]
32+
33+
mx = [mdates.date2num(t) for t in x]
34+
my = [val if val is not None else float("nan") for val in y]
35+
2736
plt.subplot(2, 1, 2)
28-
plt.plot(x, y)
37+
plt.plot(mx, my)
2938
plt.xlim(start, stop)
3039
plt.xlabel("UTC")
3140
plt.ylabel("Sink Rate")

0 commit comments

Comments
 (0)