Skip to content

Instantly share code, notes, and snippets.

@MonikaPdb
Created December 10, 2017 14:19
Show Gist options
  • Save MonikaPdb/935d7ec6261ba251e3e373ac3e61c8a7 to your computer and use it in GitHub Desktop.
Save MonikaPdb/935d7ec6261ba251e3e373ac3e61c8a7 to your computer and use it in GitHub Desktop.
#total working years
plt.figure(figsize = (8, 4))
N = 8
att_yes = (33, 17, 12, 11, 8, 5, 8, 13)
att_no = (67, 83, 88, 89, 92, 95, 92, 88)
ind = np.arange(N) # the x locations for the groups
width = 0.35 # the width of the bars: can also be len(x) sequence
p1 = plt.bar(ind, att_yes, width, color='#ab1f43')
p2 = plt.bar(ind, att_no, width, color='#1f43ab',
bottom=att_yes)
plt.ylabel('%')
plt.title('Attrition % vs Total Working Years')
plt.xticks(ind, ('0 - 5', '5 - 10', '10 - 15', '15 - 20', '20 - 25', '25 - 30', '30 - 35', '35 - 40'))
plt.yticks(np.arange(0, 100, 10))
plt.legend((p1[0], p2[0]), ('attrition yes', 'attrition no'), loc = 'upper right')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment