My Code:
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']
alist = [stem_cats, lib_arts_cats, other_cats]
for cats in alist:
fig = plt.figure(figsize=(16, 20))
count = 0
for sp in range(count, 18, 3):
cat_index = int((sp - count)/3)
if len(cats) - 1 < cat_index:
plt.show()
count += 1
continue
else:
ax = fig.add_subplot(6, 3, sp+1)
ax.plot(women_degrees['Year'], women_degrees[cats[cat_index]], c=cb_dark_blue, label='Women', linewidth=3)
ax.plot(women_degrees['Year'], 100-women_degrees[cats[cat_index]], c=cb_orange, label='Men', linewidth=3)
for key, spine in ax.spines.items():
spine.set_visible(False)
ax.set_xlim(1968, 2011)
ax.set_ylim(0, 100)
ax.set_title(cats[cat_index])
ax.tick_params(bottom='off', top='off', left='off', right='off')
if cat_index == 0:
ax.text(2003, 85, 'Women')
ax.text(2005, 10, 'Men')
elif cat_index == 5:
ax.text(2005, 87, 'Men')
ax.text(2003, 7, 'Women')
What I expected to happen:
So I was trying to plot the entire graphs in one go. I have been able to plot all in a column.
But I want them in three columns. How do I go about this?