path = get_path(__file__) + '/..' trials = range(0,51) ticklabels = [] for i in trials: if i==trials[0] or i%10 == 0: ticklabels.append(i) else: ticklabels.append('') font = {'weight': 'normal', 'size': 16} for label in L_clean: data = [d.get_trial(i).get_feature(label).view() for i in trials] plt.title('Boxplot of feature {0} in the trials {1}-{2}'.format( label, trials[0], trials[-1]), font) plt.boxplot(data) ax = plt.gca() ax.set_xticklabels(ticklabels) for tick in ax.xaxis.get_major_ticks(): tick.label1.set_fontsize(10) for tick in ax.yaxis.get_major_ticks(): tick.label1.set_fontsize(10) ax.set_xlabel('Trial Id', font) ax.set_ylabel(label, font) plt.savefig( '{0}/plots/boxplots/{1}-t{2}-t{3}.pdf'.format( path, label, trials[0], trials[-1]), format='pdf', papertype='a4')
import numpy as np from matplotlib import pyplot as plt from src.data_interface import d from src.utils import get_path path = get_path(__file__) + '/../plots/gear_idea' V10_idx = 31 IsAlert_idx = 2 for trial_id in d.trial_id_list: t = d.get_trial(trial_id) v = t.view() unique_values = t.V10.unique_values() if unique_values in [1,4,5]: fig = plt.figure() ax = fig.add_subplot(111) #ax.set_ylim(-1, 2) ax.plot(range(len(v)), v[:, V10_idx]) ax.plot(range(len(v)), v[:, IsAlert_idx]) ax.set_title('V10 vs IsAlert - Trial: %s' % (trial_id,)) file_name = '/t%s.png' % (trial_id,) fig.savefig(path + '/' + file_name)