title: How do I stop the getting blank plots when trying to use Matplotlib's subplot feature?
body: <p>I am currently working on some Vidhya articles. As part of following along, I'm running the following code:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  
  fig = plt.figure(figsize=(8,4))
  ax1 = fig.add_subplot(121)
  ax1.set_xlabel('Credit_History')
  ax1.set_ylabel('Count of Applicants')
  ax1.set_title("Applicants by Credit_History")
  temp1.plot(kind='bar')
  
  ax2 = fig.add_subplot(122)
  temp2.plot(kind = 'bar')
  ax2.set_xlabel('Credit_History')
  ax2.set_ylabel('Probability of getting loan')
  ax2.set_title("Probability of getting loan by credit history")
  </code></pre>
  
  <p>This is supposed to produce the following:</p>
  
  <p><a href="https://i.stack.imgur.com/fT22k.png" rel="nofollow noreferrer">Correct answer from Vidhya</a></p>
  
  <p>This seems straightforward enough. I understand the </p>
  
  <p>However, when I attempt this, I have been getting this no matter how much I jiggle around with things.</p>
  
  <p><a href="https://i.stack.imgur.com/zIaR7.png" rel="nofollow noreferrer">What I'm getting</a></p>
  
  <p>Obviously, this isn't right. My understanding of what is supposed to happen is:</p>
  
  <ol>
  <li>I create a figure.</li>
  <li>I specify that the figure will have two subplots, with the '121' and '122' specifying they will be horizontally adjacent to each other.</li>
  <li>As I use the 'plot' command, the subplots should be utilized in the order they were generated.</li>
  </ol>
  
  <p>Unfortunately, it seems like the code I am using is only utilizing ONE of the subplots, and then producing the other plot on a new line. I can not for the life of me figure out why this is the case.</p>
  
  <p>While writing this I read some of 'Python for Data Analysis' and tried some new code to no avail. I've also attempted to print it this way with similar results:</p>
  
  <pre><code>fig, axes = plt.subplots(1, 2, figsize=(10, 8))
  temp1.plot(kind='bar')
  temp2.plot(kind='bar')
  </code></pre>
  
  <p>The code for temp1 and temp2 are as follows:</p>
  
  <pre><code>temp1 = df['Credit_History'].value_counts(ascending=True)
  temp2 = df.pivot_table(values='Loan_Status',index['Credit_History'],aggfunc=lambda x: x.map({'Y':1,'N':0}).mean())
  </code></pre>
  
  <p>It seems that even if I print temp1 twice, the first subplot is blank for some reason. I'm really pretty stumped. The latter attempt to make it work is almost an exact copy of the code from 'Python for Data Analysis'. </p>