From 095ee19722706c13f9d3d0160b3547b24d4979d8 Mon Sep 17 00:00:00 2001 From: "Matthias@Dell" Date: Sat, 1 Jul 2023 17:01:09 +0200 Subject: [PATCH] start add plot --- m_teng/utility/data.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/m_teng/utility/data.py b/m_teng/utility/data.py index 1980429..6ba5eda 100644 --- a/m_teng/utility/data.py +++ b/m_teng/utility/data.py @@ -1,6 +1,7 @@ import pandas as pd import numpy as np from os import path +import matplotlib.pyplot def buffer2dataframe(buffer): df = pd.DataFrame(buffer) @@ -30,3 +31,23 @@ def load_dataframe(p:str): else: df = pd.read_pickle(p) return df + + +def plot(data): + if type(data) == str: + data = load_dataframe(data) + if type(data) == pd.Dataframe: + data = data.to_numpy() + fig1, (vax, iax) = plt.subplots(2, 1, figsize=(8, 5)) + # todo + + + vline, = vax.plot(index, vdata, color="m") + vax.set_ylabel("Voltage [V]") + vax.grid(True) + + vax.plot() + + iline, = iax.plot(index, idata, color="m") + iax.set_ylabel("Current [A]") + iax.grid(True)