%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=(16, 20))
for sp in range(0,18):
ax.set_xlim(1968, 2011)
ax.set_ylim(0,100)
ax.tick_params(bottom="off", top="off", left="off", right="off",labelbottom='on')
ax.set_yticks([0,100])
ax.set_xticks([1970,2010])
ax.axhline(50, c=(171/255, 171/255, 171/255), alpha = 0.3)
for i in ["right","left","top","bottom"]:
ax.spines[i].set_visible(False)
if sp in range(0,6):
plot_spot = ((3*sp)+1)
ax = fig.add_subplot(6,3,plot_spot)
ax.set_title(stem_cats[sp])
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)
elif sp in range(6,11):
sp2 = sp - 6
plot_spot = ((3*sp2)+2)
ax = fig.add_subplot(6,3,plot_spot)
ax.set_title(lib_arts_cats[sp2])
ax.plot(women_degrees['Year'], women_degrees[lib_arts_cats[sp2]], c=cb_dark_blue, label='Women', linewidth=3)
ax.plot(women_degrees['Year'], 100-women_degrees[lib_arts_cats[sp2]], c=cb_orange, label='Men', linewidth=3)
elif sp in range(11, 17):
sp3 = sp - 11
plot_spot = ((3*sp3)+3)
ax = fig.add_subplot(6,3,plot_spot)
ax.set_title(other_cats[sp3])
ax.plot(women_degrees['Year'], women_degrees[other_cats[sp3]], c=cb_dark_blue, label='Women', linewidth=3)
ax.plot(women_degrees['Year'], 100-women_degrees[other_cats[sp3]], c=cb_orange, label='Men', linewidth=3)
if sp == 0 or sp == 11 :
ax.text(2005, 8, 'Men')
ax.text(2001, 90, 'Women')
elif sp == 6:
ax.text(2005, 22, 'Men')
ax.text(2001, 75, 'Women')
elif sp == 5 or sp == 17:
ax.text(2005, 70, 'Men')
ax.text(2001, 30, 'Women')
plt.show()