Trying to plot histogram from data provided by a sensor using txt file. The file has continuously running data, It should take the data from first line but it should exclude some values in the start of the data and plot the graph then move to the next line want to do this on realtime basis. Tried few things but didn't work. I get an error could not convert string to float: '27/12/2018-14:35:30'.
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
with open('load.txt', 'r') as fx:
for line in fx:
counter = True
line = line.split(',')
for thing in line:
if counter:
counter = False
else:
print(thing)
f= np.loadtxt('load.txt', delimiter=',', unpack= True)
bins = [0,50,100,150,200]
plt.hist(f, histtype = 'bar', bins = bins, rwidth=1, color='c')
plt.xlabel('x values')
plt.ylabel('y values')
plt.title('OPC_N3 Histogram')
#plt.legend()
plt.show()
data: but it should exclude the initial values eg. in the first block of data it should take values from the first 0 and so on with the next blocks and plot histogram as the output one by one for each block of data
27/12/2018 14:35:30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,27,114,1,8,95,231,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,4,60
27/12/2018-14:36:40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,12,114,1,72,97,93,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,74,100
27/12/2018-14:37:51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,12,114,1,172,97,156,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,223,60
27/12/2018-14:39:02,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,12,114,1,1,98,185,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,130,60
27/12/2018-14:40:13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,78,12,114,1,48,98,234,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,197,182