Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added stride width to the box plot. #136

Merged
merged 2 commits into from
Feb 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified figures/unperturbed-perturbed-boxplot-comparison.pdf
Binary file not shown.
15 changes: 9 additions & 6 deletions paper.tex
Original file line number Diff line number Diff line change
Expand Up @@ -820,16 +820,19 @@ \subsection*{Processed Data}
For more insight into the difference in the unperturbed and perturbed data,
Figure~\ref{fig:gait-cycle-stats-comparison} compares the distribution of a few
gait cycle statistics. One can see that the perturbed strides have a much
larger variation in frequency and length.
larger variation in frequency and length and even larger variation in stride
width.
%
\begin{figure}
\centering
\includegraphics{figures/unperturbed-perturbed-boxplot-comparison.pdf}
\cprotect\caption{Box plots of the average belt speed, stride frequency, and
stride length which compare unperturbed (red) and perturbed (blue) gait
cycles. The median is given with the box bounding the first and third
quartiles and the whiskers bound the range of the data. Produced by
\verb|src/unperturbed_perturbed_comparison.py|.}
% NOTE : Make sure to update these values (120, 519) if anything in the
% script changes.
\cprotect\caption{Box plots of the average belt speed, stride frequency,
stride length, and stride width which compare 120 unperturbed (U: red) and
519 perturbed (P: blue) gait cycles. The median is given with the box
bounding the first and third quartiles and the whiskers bound the range of
the data. Produced by \verb|src/unperturbed_perturbed_comparison.py|.}
\label{fig:gait-cycle-stats-comparison}
\end{figure}

Expand Down
21 changes: 17 additions & 4 deletions src/unperturbed_perturbed_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,32 @@
# length.
print('Generating the box plot comparison.')

fig, axes = plt.subplots(1, 3)
fig, axes = plt.subplots(1, 4)

columns = ['Average Belt Speed', 'Stride Frequency', 'Stride Length']
units = ['[m/s]', '[Hz]', '[m]']

for col, ax, unit in zip(columns, axes.flatten(), units):
for col, ax, unit in zip(columns, axes[:-1], units):
ax.set_title('{} {}'.format(col, unit))
u = unperturbed_gait_cycle_stats[col]
p = perturbed_gait_data.gait_cycle_stats[col]
sbn.boxplot([p.values, u.values], ax=ax, color=[blue, red],
whis='range',
names=['Perturbed\nN = {}'.format(num_perturbed_cycles),
'Unperturbed\nN = {}'.format(num_unperturbed_cycles)])
names=['P', 'U'])

unperturbed_stride_widths = \
(unperturbed_gait_cycles[:, :, 'RHEE.PosZ'] -
unperturbed_gait_cycles[:, :, 'LHEE.PosZ']).values.flatten()
perturbed_stride_widths = \
(perturbed_gait_data.gait_cycles[:, :, 'RHEE.PosZ'] -
perturbed_gait_data.gait_cycles[:, :, 'LHEE.PosZ']).values.flatten()

sbn.boxplot([perturbed_stride_widths, unperturbed_stride_widths],
ax=axes[-1],
color=[blue, red],
whis='range',
names=['P', 'U'])
axes[-1].set_title('Stride Width [m]'.format(col, unit))

plt.tight_layout()

Expand Down