Skip to content

Instantly share code, notes, and snippets.

@trevismd
Last active July 21, 2021 15:20
Show Gist options
  • Save trevismd/90a527807973c508e3801398a4f26588 to your computer and use it in GitHub Desktop.
Save trevismd/90a527807973c508e3801398a4f26588 to your computer and use it in GitHub Desktop.
Annotating Plot 4
pairs =(
[('Successful', 'Robots'), ('Successful', 'Flight')],
[('Successful', 'Flight'), ('Successful', 'Sound')],
[('Successful', 'Robots'), ('Successful', 'Sound')],
[('Failed', 'Robots'), ('Failed', 'Flight')],
[('Failed', 'Flight'), ('Failed', 'Sound')],
[('Failed', 'Robots'), ('Failed', 'Sound')],
[('Live', 'Robots'), ('Live', 'Flight')],
[('Live', 'Flight'), ('Live', 'Sound')],
[('Live', 'Robots'), ('Live', 'Sound')]
)
with sns.plotting_context("notebook", font_scale = 1.4):
# Create new plot
ax = get_log_ax()
# Plot with seaborn
ax = sns.boxplot(ax=ax, **hue_plot_params)
# Add annotations
annotator = Annotator(ax, pairs, **hue_plot_params)
annotator.configure(test="Mann-Whitney", verbose=False)
_, results = annotator.apply_and_annotate()
# Label and show
add_legend(ax)
label_plot_for_states(ax)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment