title: For to configure matplotlib subplots within a for loop
body: <p>I'm trying to loop through some data in a Pandas dataframe and plot into different subplots, but not quite sure what I've got wrong.</p>
  <p>Here's the code:</p>
  <pre><code>df2 = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))
  fig, axes = plt.subplots(nrows=4, ncols=1, sharex=True)
  for i, col in enumerate(df2.columns):
      print(col)
      axes[i] = df2[col].plot(kind=&quot;box&quot;)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/AFKld.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AFKld.png" alt="enter image description here" /></a></p>
  <p>How can I fill up the other subplots?</p>