Thanks for the well explained mission I really enjoyed this one antd the guided project was intresting and not hard. Here it is
maybe is usefull for someone
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
women_degrees = pd.read_csv('percent-bachelors-degrees-women-usa.csv')
cb_dark_blue = (0/255,107/255,164/255)
cb_orange = (255/255, 128/255, 14/255)
stem_cats = ['Psychology', 'Biology', 'Math and Statistics', 'Physical Sciences', 'Computer Science', 'Engineering']
lib_arts_cats = ['Foreign Languages', 'English', 'Communications and Journalism', 'Art and Performance', 'Social Sciences and History']
other_cats = ['Health Professions', 'Public Administration', 'Education', 'Agriculture','Business', 'Architecture']
fig = plt.figure(figsize=(18,18))
for sp in range(0,6):
ax = fig.add_subplot(6,3,sp*3+1)
ax.plot(women_degrees['Year'], women_degrees[stem_cats[sp]], c=cb_dark_blue, label='Women', linewidth=3)
ax.plot(women_degrees['Year'], 100-women_degrees[stem_cats[sp]], c=cb_orange, label='Men', linewidth=3)
ax.spines["right"].set_visible(False)
ax.spines["left"].set_visible(False)
ax.spines["top"].set_visible(False)
ax.spines["bottom"].set_visible(False)
ax.set_xlim(1968, 2011)
ax.set_ylim(0,100)
ax.set_yticks([0,100])
ax.axhline(50, c=(171/255, 171/255, 171/255), alpha=0.3)
ax.set_title(stem_cats[sp])
ax.tick_params(bottom="off", top="off", left="off", right="off", labelbottom='off')
if sp == 0:
ax.text(2005, 87, 'Women')
ax.text(2002, 8, 'Men')
elif sp == 5:
ax.text(2005, 90, 'Men')
ax.text(2001, 8, 'Women')
ax.tick_params(labelbottom='on')
for lc in range(0,5):
ax = fig.add_subplot(6,3,lc*3+2)
ax.plot(women_degrees['Year'], women_degrees[lib_arts_cats[lc]], c=cb_dark_blue, label='Women', linewidth=3)
ax.plot(women_degrees['Year'], 100-women_degrees[lib_arts_cats[lc]], c=cb_orange, label='Men', linewidth=3)
ax.spines["right"].set_visible(False)
ax.spines["left"].set_visible(False)
ax.spines["top"].set_visible(False)
ax.spines["bottom"].set_visible(False)
ax.set_xlim(1968, 2011)
ax.set_ylim(0,100)
ax.set_yticks([0,100])
ax.axhline(50, c=(171/255, 171/255, 171/255), alpha=0.3)
ax.set_title(lib_arts_cats[lc])
ax.tick_params(bottom="off", top="off", left="off", right="off", labelbottom='off')
if lc == 0:
ax.text(2005, 75, 'Men')
ax.text(2002, 20, 'Women')
if lc == 4:
ax.tick_params(labelbottom='on')
for oc in range(0,6):
ax = fig.add_subplot(6,3,oc*3+3)
ax.plot(women_degrees['Year'], women_degrees[other_cats[oc]], c=cb_dark_blue, label='Women', linewidth=3)
ax.plot(women_degrees['Year'], 100-women_degrees[other_cats[oc]], c=cb_orange, label='Men', linewidth=3)
ax.spines["right"].set_visible(False)
ax.spines["left"].set_visible(False)
ax.spines["top"].set_visible(False)
ax.spines["bottom"].set_visible(False)
ax.set_xlim(1968, 2011)
ax.set_ylim(0,100)
ax.set_yticks([0,100])
ax.axhline(50, c=(171/255, 171/255, 171/255), alpha=0.3)
ax.set_title(other_cats[oc])
ax.tick_params(bottom="off", top="off", left="off", right="off", labelbottom='off')
if oc == 0:
ax.text(2005, 87, 'Men')
ax.text(2002, 8, 'Women')
if oc == 5:
ax.text(2005, 70, 'Men')
ax.text(2002, 25, 'Women')
ax.tick_params(labelbottom='on')
plt.show()
plt.savefig('biology_degrees.png')