Commit 5bf8866a authored by Mario Hock's avatar Mario Hock
Browse files

some very basic matplotlib output

parent 8da0be9f
......@@ -2,11 +2,22 @@
# -*- coding:utf-8 -*-
import sys
import matplotlib
import matplotlib.pyplot as plt
from cnl_library import CNLParser
def append_twice(base_list, extend_list):
if ( isinstance(extend_list, list) ):
for x in extend_list:
base_list.append(x)
base_list.append(x)
else:
base_list.append(extend_list)
base_list.append(extend_list)
## MAIN ##
if __name__ == "__main__":
......@@ -27,8 +38,37 @@ if __name__ == "__main__":
## Display some csv/data fields.
names = None
names = ["eth0.send", "eth0.receive"]
names = ["begin", "end", "eth0.send", "eth0.receive"]
print( names )
### Prepare lists for matplotlib.
#x_values = list()
#y1_values = list()
#y2_values = list()
#for x in cnl_file.get_csv_iterator(names):
#x_values.extend( x[0:2] )
#append_twice( y1_values, x[2] )
#append_twice( y2_values, x[3] )
## Prepare lists for matplotlib.
x_values = list()
y1_values = list()
y2_values = list()
for x in cnl_file.get_csv_iterator(names):
print( ", ".join(x) )
x_values.append( x[1] )
y1_values.append( x[2] )
y2_values.append( x[3] )
## Plot with matplotlib.
print( x_values )
print( y1_values )
print( y2_values )
plt.plot(x_values, y1_values)
plt.plot(x_values, y2_values)
#plt.ylabel('some numbers')
plt.show()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment