TTT4260/D1/Graphs/graphs.py

37 lines
700 B
Python
Raw Normal View History

2020-10-04 23:39:01 +02:00
#!/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 = "MaxMeasure"
with open(filename + ".csv") as csvfile:
csvreader = csv.reader(csvfile)
header = next(csvreader)
for dataplot in csvreader:
values = [float(value) for value in dataplot]
data.append(values)
time = [p[0] for p in data]
ch1 = [p[1] for p in data]
ch2 = [p[2] for p in data]
plt.plot(time,ch1, time,ch2)
plt.xlabel("Tid (s)")
plt.ylabel("Spenning (V)")
plt.legend(["Dempet signal","Inngangssignal"])
plt.savefig(filename + ".png", dpi=200)
plt.show()