num_subjects = 8 bar_color = [0.75, 0.75, 0.75] x_pos = np.arange(0, 2) scatter_pts = np.linspace(-0.1, 0.1, num_subjects) phase_err_data = np.concatenate( (data['phase_ekf_err_mean'], data['phase_time_err_mean']), 1) phase_err_median = np.median(phase_err_data, 0) #add num falls ax.bar(x_pos, phase_err_median, color=bar_color, tick_label=('GP-EKF', 'Time-Based')) add_barplot_sigstars(ax, np.array([(0, 1)]), data['p_values'].flatten(), x_pos) scatter_opts = {'s': 24, 'zorder': 10} subject_list = np.concatenate((np.arange(1, 8), [0])) marker_able = 'o' marker_exp = 's' for i in range(2): for sub in subject_list: if sub == 0: marker = marker_exp else: marker = marker_able ax.scatter(x_pos[i] + scatter_pts[sub], phase_err_data[sub, i], marker=marker,
ax.set_ylabel('Number of Falls') num_subjects = 10 bar_color = [0.75, 0.75, 0.75] x_pos = np.array((0, 1, 2, 3, 5, 6, 7, 8)) scatter_pts = np.linspace(-0.1, 0.1, num_subjects / 2) ax.bar(x_pos, np.median(data['fall_counts_subopt'], 0), color=bar_color, tick_label=('NM', 'NM\nsubopt', 'IMP', 'IMP\nsubopt', 'NM', 'NM\nsubopt', 'IMP', 'IMP\nsubopt')) add_barplot_sigstars(ax, data['condition_combinations_subopt'] - 1, data['p_values_falls_subopt'], x_pos, star_loc='level') subject_list = range(num_subjects) scatter_opts = {'s': 10, 'zorder': 10, 'marker': 'o'} for i in range(8): if any([i == elem for elem in [0, 1, 4, 5]]): colors_sub = colors[1:num_subjects + 2:2] else: colors_sub = colors[0:num_subjects + 2:2] ax.scatter(x_pos[i] + scatter_pts, data['fall_counts_subopt'][:, i], color=colors_sub, **scatter_opts)
fig, ax = plt.subplots(1, 1, figsize=(4.5, 2)) ax.set_ylabel('Number of Falls') num_subjects = 10 bar_color = [0.75, 0.75, 0.75] x_pos = np.array((0, 1, 2, 4, 5, 6)) scatter_pts = np.linspace(-0.1, 0.1, num_subjects) ax.bar(x_pos, np.median(data['fall_counts'], 0), color=bar_color, tick_label=('No Pros', 'NM', 'IMP', 'No Pros', 'NM', 'IMP')) add_barplot_sigstars(ax, data['condition_combinations'] - 1, data['p_values_falls'], x_pos, star_loc='3x3') subject_list = range(num_subjects) scatter_opts = {'s': 10, 'zorder': 10, 'marker': 'o'} for i in range(6): ax.scatter(x_pos[i] + scatter_pts, data['fall_counts'][:, i], color=colors, **scatter_opts) trans = transforms.blended_transform_factory(ax.transData, ax.transAxes) group_label_props = { 'horizontalalignment': 'center', 'verticalalignment': 'center',
fig, ax = plt.subplots(1, 1, figsize=(2, 2)) ax.set_ylabel(r"Ankle Net Work (\unitfrac{J}{kg})") num_subjects = 10 bar_color = [0.75, 0.75, 0.75] x_pos = np.array((0, 1)) scatter_pts = np.linspace(-0.1, 0.1, num_subjects) ax.bar(x_pos, np.mean(data['ankle_net_work'][:, 1:], 0), color=bar_color, tick_label=('NM', 'IMP')) add_barplot_sigstars(ax, np.array([[0, 1]]), np.array([data['p_values_ankle_net_work'][2]]), x_pos, star_loc='level') subject_list = range(num_subjects) scatter_opts = {'s': 10, 'zorder': 10, 'marker': 'o'} for i in range(2): ax.scatter(x_pos[i] + scatter_pts, data['ankle_net_work'][:, i + 1], color=colors, **scatter_opts) trans = transforms.blended_transform_factory(ax.transData, ax.transAxes) group_label_props = { 'horizontalalignment': 'center', 'verticalalignment': 'center',
fig, ax = plt.subplots(1, 1, figsize=(4.5, 3)) ax.set_ylabel('Step Length\nVariability (mm)') num_subjects = 10 bar_color = [0.75, 0.75, 0.75] x_pos = np.array((0, 1, 2, 4, 5, 6)) scatter_pts = np.linspace(-0.1, 0.1, num_subjects) ax.bar(x_pos, np.mean(data['step_length_var'], 0), color=bar_color, tick_label=('No Pros', 'NM', 'IMP', 'No Pros', 'NM', 'IMP')) add_barplot_sigstars(ax, data['condition_combinations'] - 1, data['p_values_step_length_var'], x_pos, star_loc='3x3') subject_list = range(num_subjects) scatter_opts = {'s': 10, 'zorder': 10, 'marker': 'o'} for i in range(6): ax.scatter(x_pos[i] + scatter_pts, data['step_length_var'][:, i], color=colors, **scatter_opts) trans = transforms.blended_transform_factory(ax.transData, ax.transAxes) group_label_props = { 'horizontalalignment': 'center', 'verticalalignment': 'center',
num_subjects = 9 bar_color = [0.75, 0.75, 0.75] x_pos = np.arange(0,3) scatter_pts = np.linspace(-0.1,0.1,num_subjects) scatter_opts = {'s':8, 'zorder':10} subject_list = np.concatenate((np.arange(1,8), [0], [8])) marker_able = 'o' marker_amp = '^' marker_exp = 's' #plot bar plots and sig stars ax[0,0].bar(x_pos, 180/np.pi*data['knee_angle_errors_median'].flatten(), color = bar_color) add_barplot_sigstars(ax[0,0], data['condition_combinations']-1, data['p_values_knee_angle'].flatten(), x_pos, star_loc='3x1') ax[0,1].bar(x_pos, 180/np.pi*data['ankle_angle_errors_median'].flatten(), color = bar_color) add_barplot_sigstars(ax[0,1], data['condition_combinations']-1, data['p_values_ankle_angle'].flatten(), x_pos, star_loc='3x1') ax[1,0].bar(x_pos, data['knee_moment_errors_median'].flatten(), color = bar_color, tick_label=('GP-EKF','NM','IMP')) add_barplot_sigstars(ax[1,0], data['condition_combinations']-1, data['p_values_knee_moment'].flatten(), x_pos, star_loc='3x1') ax[1,1].bar(x_pos, data['ankle_moment_errors_median'].flatten(), color = bar_color, tick_label=('GP-EKF','NM','IMP')) add_barplot_sigstars(ax[1,1], data['condition_combinations']-1, data['p_values_ankle_moment'].flatten(), x_pos, star_loc='3x1')
ax.set_ylabel('Phase Transition\nSuccess Rate') num_subjects = 10 bar_color = [0.75, 0.75, 0.75] x_pos = np.array((0, 1)) scatter_pts = np.linspace(-0.1, 0.1, num_subjects) ax.bar(x_pos, np.mean(data['phase_success'], 0), color=bar_color, tick_label=('No Disturb', 'w/ Disturb')) pdb.set_trace() add_barplot_sigstars(ax, np.array([data['condition_combinations'] - 1]), np.array([data['p_values_phase_success']]), x_pos, star_loc='level') subject_list = range(num_subjects) scatter_opts = {'s': 10, 'zorder': 10, 'marker': 'o'} for i in range(2): ax.scatter(x_pos[i] + scatter_pts, data['phase_success'][:, i], color=colors, **scatter_opts) trans = transforms.blended_transform_factory(ax.transData, ax.transAxes) group_label_props = { 'horizontalalignment': 'center', 'verticalalignment': 'center',