Hi Everyone,
I am trying to create a graph that can be updated whenever a new data point is recorded.
As a bare example I am reading in the newly added characters ti var/log/system.log file and trying to plot that.
Now anytime a new data point is added a new window is opened in the browser which is annoying. Is there a way to do something like ββhold onββ? Code is copied below.
Any help is appreciated!
import subprocess
import os
import time
import numpy as np
import plotly.offline as py
import plotly.graph_objs as go
l=[]
n=np.zeros(shape=(300,1))
i = 0
while i < 300:
mytext1 = len(str(subprocess.check_output(['cat', '/var/log/system.log']),'ascii'))
time.sleep(5)
mytext2 = len(str(subprocess.check_output(['cat', '/var/log/system.log']),'ascii'))
n[[i,1]]=mytext2-mytext1
i = i+1
# l.append(mytext2-mytext1)
trace = go.Scatter(
x = np.arange(i),
y = n[0:i,0]
)
# print(y)
data = [trace]
py.plot(data, filename='basic-line.html')