Screen Link:
My Code:
fig, ax = plt.subplots()
ax.plot(women_degrees['Year'], women_degrees['Biology'], c='blue', label='Women')
ax.plot(women_degrees['Year'], 100-women_degrees['Biology'], c='green', label='Men')
ax.tick_params(bottom="off", top="off", left="off", right="off")
ax.set_title('Percentage of Biology Degrees Awarded By Gender')
ax.legend(loc="upper right")
plt.show()
Hi,
In assignment 147.6 I am trying to understand the logic behind the code. I have two questions about this:
- Why do we use a subplot
plt.subplots()
instead of a figure plot (plt.figure()
)? In the previous assignment, we did the opposite (https://app.dataquest.io/m/147/improving-plot-aesthetics/4/visualizing-the-gender-gap ) - When do we use
ax.set_title
in stead ofplt.title
?