Skip to content

Instantly share code, notes, and snippets.

@aviad
Created February 9, 2019 08:40
Show Gist options
  • Save aviad/126b4e6ee880dcfc649f1a6def15b32b to your computer and use it in GitHub Desktop.
Save aviad/126b4e6ee880dcfc649f1a6def15b32b to your computer and use it in GitHub Desktop.
# Happy Colors Version
import numpy as np
import matplotlib.pyplot as plt
groups = ('HSI', 'HNI', 'Control')
N = len(groups)
pre_interverntion = (1.52, 1.72, 1.55)
pre_interverntion_std = (0.05, 0.07, 0.07)
post_intervention = (1.72, 1.61, 1.63)
post_intervention_std = (0.06, 0.08, 0.06)
fig, ax = plt.subplots()
ind = np.arange(N) # the x locations for the groups
width = 0.25 # the width of the bars
errbar_color = '0.3'
p1 = ax.bar(ind, pre_interverntion, width,
color='#dd1c77', bottom=0,
yerr=pre_interverntion_std, ecolor=errbar_color)
p2 = ax.bar(ind + width, post_intervention, width,
color='#c994c7', bottom=0,
yerr=post_intervention_std, ecolor=errbar_color)
# ax.set_title('Co-Sleeping by Group and Phase and More Words')
ax.set_xticks(ind + width / 2)
ax.set_xticklabels(groups)
ax.set_aspect(5.3)
ax.set_ylim((1, 2))
ax.legend((p1[0], p2[0]), ('Pre', 'Post'), bbox_to_anchor=(1.6, 0.5))
plt.text(0 + width/2, 1.79, '**', ha='center', va='center')
plt.box(on=None)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment