From f06ccc2e6a74ea7485ffd5fed07cac81877f3ae1 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 26 May 2025 21:07:08 +0200 Subject: [PATCH] CSVVisualizer.py aktualisiert self.ax.margins(x=0) tells matplotlib not to add padding on the x-axis. (Chat) --- CSVVisualizer.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CSVVisualizer.py b/CSVVisualizer.py index 86dab78..09c440d 100644 --- a/CSVVisualizer.py +++ b/CSVVisualizer.py @@ -77,6 +77,7 @@ class CSVVisualizer: try: # First detect problematic lines self.status_var.set("Datei geladen – prüfe Zeilen…") + self.root.update_idletasks() good_lines = [] with open(filepath, 'r') as f: reader = csv.reader(f) @@ -98,10 +99,12 @@ class CSVVisualizer: if not good_lines: messagebox.showwarning("Warnung", "Keine gültigen Datenzeilen gefunden.") self.status_var.set("Keine gültigen Daten") + self.root.update_idletasks() return # Now read only valid lines self.status_var.set("Verarbeite gültige Zeilen…") + self.root.update_idletasks() self.df = pd.read_csv( filepath, skiprows=lambda x: x not in good_lines and x != 0, # keep header @@ -121,6 +124,7 @@ class CSVVisualizer: self.file_label.config(text=os.path.basename(filepath)) self.status_var.set(f"Loaded: {len(self.df)} valid measurements") + self.root.update_idletasks() self.update_plot() except Exception as e: @@ -144,6 +148,7 @@ class CSVVisualizer: # Spannung plotten self.ax.plot(df_clean["Relative_Time(s)"], df_clean["Voltage(V)"], label="Voltage (V)", color="black", linewidth=1.5) + self.ax.margins(x=0) # Phasen als farbige Hintergründe start_idx = 0