import matplotlib.pyplot as plt import numpy as np def plot_duration_part(dataset): plt.figure(figsize=(18, 7)) plt.xlabel("Parts chronologically ordered") plt.ylabel("Duration Minutes") #print(dataset) #dataset = dataset[~np.all(dataset['keys'] == 0, axis=0)] x = dataset['keys'] # y=y[~np.all(y==0,axis=1)] # y[y==0] = np.nan x_str=[] for entry in x: x_str.append(str(entry)) y = dataset['data'] #plt.xticks(range(len(x)), str(x)) plt.margins(x=0) plt.xticks(rotation=70, fontsize=9) plt.subplots_adjust(left=0.05, right=1, bottom=0.15) plt.plot(x_str, y, label=str("OverallDuration")) plt.legend() plt.title("MeasureResultsPPart") plt.show() def plot_duration_part_cap(dataset): plt.figure(figsize=(18, 7)) plt.xlabel("Parts") plt.ylabel("Duration Minutes") #print(dataset) #dataset = dataset[~np.all(dataset['keys'] == 0, axis=0)] x = dataset['keys'] # y=y[~np.all(y==0,axis=1)] # y[y==0] = np.nan x_str=[] for entry in x: x_str.append(str(entry)) y = dataset['data'] #plt.xticks(range(len(x)), str(x)) plt.margins(x=0) plt.xticks(rotation=70, fontsize=9) plt.subplots_adjust(left=0.05, right=1, bottom=0.15) plt.plot(x_str, y, label=str("OverallDuration")) plt.ylim([2,6]) plt.legend() plt.title("MeasureResultsPPart") plt.show() def plot_all_measures(measures_dict): f = open('jbg.txt', 'a') datasets ={} for entry in measures_dict: for key in measures_dict[entry]: datasets.update({key:np.zeros((len(measures_dict)+1,1),dtype=[('keys' , int),('data',float)])}) break for entry in measures_dict: print("------------", file=f) print("------------", file=f) print(entry, file=f) print("------------", file=f) for measure in measures_dict[entry]: part=entry dataset = datasets[measure] print(dataset, file=f) dataset [part][0] = entry+1,measures_dict[entry][measure] # print(dataset[part][0], file=f) # print("------------", file=f) datasets.update({measure : dataset}) print("------------", file=f) print("------------", file=f) plt.figure(figsize=(18, 7)) plt.xlabel("Parts") plt.ylabel("0 to 1") for measure in datasets: if measure not in ("Kreis Ø19,2-1-Mitte Z","Kreis Ø19,2-1-Durchmesser","Kreis Ø19,2-2-Mitte Z","Kreis Ø19,2-2-Durchmesser","Zylinder Ø4,5-B-Durchmesser", "Zylinder Ø4,5-B-Zylinderform","Distanz Z4,8-Distanz Z"): continue dataset = datasets[measure] dataset=dataset[~np.all(dataset['keys']==0, axis=1)] y=dataset['keys'] x=dataset['data'] plt.ylim(-0.5, 2.5) plt.xticks(np.arange(0,len(x),2)) #plt.xticks(range(len(x)), y) plt.xticks(rotation=70, fontsize=10) plt.subplots_adjust(left=0.05, right=1, bottom=0.15) print(measure) plt.plot(y,x, label=str(measure)) plt.legend() x = np.arange(1,len(x)) y = [1]*len(x) plt.plot(x, y, color='red', linestyle='-.') y = [0] * len(x) plt.plot(x, y, color='red', linestyle='-.') plt.title("MeasureResultsPPart") plt.show() def plot_zylinder_part(dataset): plt.figure(figsize=(18, 7)) plt.xlabel("Parts") plt.ylabel("Zylinder Values") x = dataset['keys'] x_str = [] for entry in x: x_str.append(str(entry)) y = dataset['data'] plt.margins(x=0) plt.xticks(rotation=70, fontsize=9) plt.subplots_adjust(left=0.05, right=1, bottom=0.15) plt.hlines(y=1.0, xmin=1, xmax=100, linewidth=1, color='r', linestyles='dashed') plt.hlines(y=0.0, xmin=1, xmax=100, linewidth=1, color='r', linestyles='dashed') plt.plot(x_str, y, label=str("Zylinder Values Change")) plt.legend() plt.title("MeasureResultsZylinder") plt.show()