Skip to content

Instantly share code, notes, and snippets.

@trevismd
Last active July 25, 2021 13:51
Show Gist options
  • Save trevismd/63a87f3b6d7005d79cbd13543f90428a to your computer and use it in GitHub Desktop.
Save trevismd/63a87f3b6d7005d79cbd13543f90428a to your computer and use it in GitHub Desktop.
A horizontal barplot
hue_plot_params = {**hue_plot_params,
'x': 'Goal','y': 'State',
'dodge': True, 'orient': 'h'}
with sns.plotting_context("notebook", font_scale=1.4):
# Create new plot
ax = get_log_ax('h')
# Plot with seaborn
ax = sns.barplot(ax=ax, **hue_plot_params)
# Add annotations
annotator = Annotator(ax, pairs, plot='barplot', **hue_plot_params)
annotator.configure(test="Mann-Whitney", comparisons_correction="BH",
verbose=False, loc="outside").apply_and_annotate()
# Label and show
ax.set_xlabel("Goal ($)")
ax.set_ylabel("Project State")
plt.title("Goal amounts per project State")
ax.legend(loc=(1.05, 0))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment