-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlivePlottting_test.py
67 lines (56 loc) · 1.39 KB
/
livePlottting_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
"""
@author: Vaisakh
"""
import dash
from dash.dependencies import Output, Input
import dash_core_components as dcc
import dash_html_components as html
import plotly
import plotly.graph_objs as go
from collections import deque
import datetime
import time
from pyorbital.orbital import Orbital
satellite = Orbital('AQUA')
X = []
Y = []
X.append(time.strftime("%H:%M:%S"))
lon, lat, alt = satellite.get_lonlatalt(datetime.datetime.now())
Y.append(alt)
initial_trace = go.Scatter(
x=list(X),
y=list(Y),
name='Scatter',
mode='lines+markers'
)
app = dash.Dash(__name__)
app.layout = html.Div(
[
dcc.Graph(id='live-graph',
animate=False,
figure={'data': [initial_trace]
}),
dcc.Interval(
id='graph-update',
interval=1*1000
),
]
)
@app.callback(Output('live-graph', 'figure'),
[Input('graph-update', 'n_intervals')])
def update_graph_scatter(n):
import time
lon, lat, alt = satellite.get_lonlatalt(datetime.datetime.now())
X.append(time.strftime("%H:%M:%S"))
Y.append(alt)
trace = go.Scatter(
x=X,
y=Y,
name='Scatter',
mode='lines'
)
return {'data': [trace]
}
if __name__ == '__main__':
app.run_server(debug=True)