moved python3 prototyping to the python folder
This commit is contained in:
44
python/plotter.py
Executable file
44
python/plotter.py
Executable file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/pypy3
|
||||
import plotly.graph_objs as go
|
||||
from decimal import *
|
||||
from sys import argv
|
||||
|
||||
|
||||
def main():
|
||||
chart = go.Figure()
|
||||
chart.add_trace(go.Scatter(x=[1,2,3], y=[1,2,3]))
|
||||
chart.show()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(argv) == 1:
|
||||
main()
|
||||
else:
|
||||
chart = go.Figure()
|
||||
filenames = argv[1:]
|
||||
all_data = {}
|
||||
for filename in filenames:
|
||||
f = open(filename, "rt")
|
||||
data = {"X":[], "Y":[]}
|
||||
all_data[filename] = data
|
||||
for line in f:
|
||||
try:
|
||||
line_splt = line.split(",")
|
||||
print(line_splt)
|
||||
x = line_splt[0]
|
||||
y = line_splt[1]
|
||||
#print(x,y)
|
||||
x = float(x)
|
||||
y = float(y)
|
||||
data["X"].append(x)
|
||||
data["Y"].append(y)
|
||||
except ValueError:
|
||||
pass
|
||||
except IndexError:
|
||||
pass
|
||||
f.close()
|
||||
print("data samples:",len(data["X"]))
|
||||
chart.add_trace(go.Scatter(x=data["X"], y=data["Y"], name=filename))
|
||||
# chart.update_layout(title=argv[1])
|
||||
chart.show()
|
||||
|
||||
Reference in New Issue
Block a user