Let’s dissect the whole
for loop to see what’s happening there.
for r in range(0,4):
you are going to iterate for each value of
r: 0, 1, 2, 3. Four iteration in total.
For each iteration:
- you are going to add a subplot on a grid consisting of 4 rows and 1 column in the position defined by value of
ax = fig.add_subplot(4, 1, r+1)
- Plot a histogram on the subplot added in step 1. The data for the histogram will correspond to the column name with index
r from the list
cols defined in the primer line of your code.
ax = recent_grads[cols[r]].plot(kind='hist', rot=30)
If you have doubts on how the
.add_subplot() method works, you can check the mission on multiple plots (https://app.dataquest.io/m/143/multiple-plots/1/recap).
Please, check also the guides on formatting a question for the convenience of all members of the Community: Guidelines for asking a technical question in our Community, which include the recommendation to provide all the code as the markdown and not a screenshot and also include the URL link to the mission you have your doubts about.