Skip to content

Instantly share code, notes, and snippets.

@trevismd
Last active July 21, 2021 15:45
Show Gist options
  • Save trevismd/0667c1b7a4193f395748d0ba58ecdd65 to your computer and use it in GitHub Desktop.
Save trevismd/0667c1b7a4193f395748d0ba58ecdd65 to your computer and use it in GitHub Desktop.
Annotating Plot 3
hue_plot_params = {
'data': rfs,
'x': 'Subcategory',
'y': 'Goal',
"order": subcat_order,
"hue": "State",
"hue_order": states_order,
"palette": state_palette
}
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").apply_and_annotate()
# Label and show
add_legend(ax)
label_plot_for_subcats(ax)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment