for voltage in voltages: fig = plt.figure() comp_color_map.reset() for number, root_dir in enumerate(root_dirs): data =[] for temperature in temperatures: next_frame = input_frame[(input_frame.root_dir == root_dir) & (input_frame.temperature == temperature) & (input_frame.pressure == pressure) & (input_frame.voltage == voltage)] data.append(next_frame.result.tolist()) if plot_violin: fplot.plot_violin(data, each_dir_data_positions[number], body_color = comp_color_map.get_color(False), opacity = opacity) if plot_box: fplot.plot_box(data, each_dir_data_positions[number], box_color = "k") if plot_swarm: fplot.plot_swarm(data, each_dir_data_positions[number], color=comp_color_map.get_color(False), marker ="o", ms=10, diff=0.1) else: pass fplot.add_label(root_dir.replace('_',' '), comp_color_map.get_color(True), line_width = 0, line_style = '-', marker = 'o', marker_size = 10) fplot.modify_ticks(temperatures, labels_positions, action = "clear") plt.xlim(labels_positions[0]-2, labels_positions[len(labels_positions)-1]+2) if pressure == 4500: plt.plot(labels_positions, [-700,-700,-700,-700,-500,-700], 'k', ls = '--') if pressure == 8500: plt.plot(labels_positions, [ 700, 700, 700, 700, 500, 700], 'k', ls = '--') if pressure == 6000: plt.plot(labels_positions, [-700,-700,-700,-700,-500,-700], 'k', ls = '--') plt.plot(labels_positions, [ 700, 700, 700, 700, 500, 700], 'k', ls = '--') else:
import matplotlib.pyplot as plt import pandas as pd import functions_io as fio import functions_csv as fcsv import functions_plot as fplot import functions_excel as fexcel import functions_data_processing as fdp fplot.set_rc_params(font_size_offset=4) path = r'X:/Dnox/Tesla/2017/E1700224-08/data/recording/ecr_samples.xlsx' frame = pd.read_excel(path, usecols=[0, 1]).dropna() ecr_maxima = frame["Maximum force"].tolist() fplot.plot_swarm([ecr_maxima], [1], color='b') fplot.plot_violin([ecr_maxima], [1]) path = r'X:/Dnox/Tesla/2017/E1700224-08/data/recording/serial_samples.xlsx' frame = pd.read_excel(path, usecols=[0, 1]).dropna() series_maxima = frame["Maximum force"].tolist() fplot.plot_violin([series_maxima], [2], body_color='g') fplot.plot_swarm([series_maxima], [2], color='g') fplot.set_plot_config(xa_label='sample groups sequence', ya_label='Force [N]', title='', xlim=[0, 3], ylim=[None, None]) fplot.modify_ticks(['ecr samples', 'series samples'], [1, 2])