Add D3
This commit is contained in:
8193
D3/grafer/Trekantpuls3k.csv
Normal file
8193
D3/grafer/Trekantpuls3k.csv
Normal file
File diff suppressed because it is too large
Load Diff
BIN
D3/grafer/Trekantpuls3k.png
Normal file
BIN
D3/grafer/Trekantpuls3k.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 154 KiB |
39
D3/grafer/graphs.py
Normal file
39
D3/grafer/graphs.py
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Sun Jan 13 16:30:58 2019
|
||||
|
||||
@author: oyvind
|
||||
"""
|
||||
|
||||
import csv
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
header = []
|
||||
data = []
|
||||
|
||||
filename = "Trekantpuls3k"
|
||||
|
||||
|
||||
with open(filename + ".csv") as csvfile:
|
||||
csvreader = csv.reader(csvfile)
|
||||
|
||||
header = next(csvreader)
|
||||
|
||||
for dataplot in csvreader:
|
||||
print(dataplot)
|
||||
values = [float(value) for value in dataplot]
|
||||
|
||||
data.append(values)
|
||||
|
||||
time = [p[0] * 1000 for p in data]
|
||||
ch1 = [p[1] for p in data]
|
||||
ch2 = [p[2] for p in data]
|
||||
|
||||
plt.figure(figsize=(12,5))
|
||||
plt.plot(time,ch1, time,ch2)
|
||||
plt.xlabel("Tid (ms)")
|
||||
plt.ylabel("Spenning (V)")
|
||||
plt.legend(["Trekantpuls","Firkantpuls"], loc="upper right")
|
||||
plt.savefig(filename + ".png", dpi=300)
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user