#import of the libraries import pandas as pd from matplotlib import pyplot as plt #import numpy as np import mplcursors import tkinter as tk from matplotlib.widgets import Button, CheckButtons, TextBox, Slider from scipy.signal import butter, filtfilt #read the csv-files root = tk.Tk() root.withdraw() filename = tk.filedialog.askopenfilename() md = pd.read_csv(filename) #measured data #plotten fig, ax = plt.subplots() b, a = butter(4, 0.05, btype='low') #filter settings y1 = filtfilt(b,a, md.ch3) l1, = ax.plot(md.time, md.ch1, lw = 1, label = "Fx") l2, = ax.plot(md.time, md.ch2, lw = 1, label = "Fy") l3, = ax.plot(md.time, md.ch3, lw = 1, label = "Fz") l31, = ax.plot(md.time, y1, lw = 1, label = "FzF") l4, = ax.plot(md.time, md.ch4, lw = 1, label = "Mx") l5, = ax.plot(md.time, md.ch5, lw = 1, label = "My") l6, = ax.plot(md.time, md.ch6, lw = 1, label = "Mz") lines = [l1, l2, l3, l31, l4, l5, l6] #design of the diagram plt.title("Fahrradmessung") plt.xlabel("Zeit") plt.ylabel("Kraft in N - Moment in Nm") plt.grid() plt.xticks([]) #hide x-axis #plt.subplots_adjust(left=0.1) plt.subplots_adjust(right=0.8) #plt.legend() mplcursors.cursor(hover=True) #display hover #plt.text(0.8, 0.4, 'Max:') #checkboxes to hide the unfiltered graphes rax = plt.axes([0.85, 0.8, 0.1, 0.15]) labels = [str(line.get_label()) for line in lines] visibility = [line.get_visible() for line in lines] check = CheckButtons(rax, labels, visibility) def func(label): index = labels.index(label) lines[index].set_visible(not lines[index].get_visible()) plt.draw() check.on_clicked(func) plt.show()