Skip to content

Instantly share code, notes, and snippets.

@trevismd
Last active July 21, 2021 15:46
Show Gist options
  • Save trevismd/dfa6b732155ec812c12b4d6ebdfa8327 to your computer and use it in GitHub Desktop.
Save trevismd/dfa6b732155ec812c12b4d6ebdfa8327 to your computer and use it in GitHub Desktop.
Annotating plot 2
pairs = [
("Successful", "Failed"),
("Successful", "Live"),
("Failed", "Live"),
("Canceled", "Successful"),
("Canceled", "Failed"),
("Canceled", "Live")
]
state_plot_params = {
'data': rfs,
'x': 'State',
'y': 'Goal',
'order': states_order,
'palette': states_palette
}
with sns.plotting_context('notebook', font_scale = 1.4):
# Create new plot
ax = get_log_ax()
# Plot with seaborn
sns.boxplot(ax=ax, **state_plot_params)
# Add annotations
annotator = Annotator(ax, pairs, **state_plot_params)
annotator.configure(test='Mann-Whitney').apply_and_annotate()
# Label and show
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