title: How to get two subplots side-by-side in matplotlib?
body: <p>I just used following code to plot 2 subplot:</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>
  
  <h1>I am getting following output</h1>
  
  <p><img src="https://i.stack.imgur.com/4lTwK.png" alt="Screenshot 1"></p>
  
  <p><img src="https://i.stack.imgur.com/UkHj5.png" alt="Screenshot 2"></p>
  
  <p>I am getting 3 plots i.e. 2 subplots as I intended, however the second one empty with titles as described. And third one underneath the two with bars for temp2 without the titles.</p>
  
  <p>What I want are two subplots side by side with titles as described. Wondering what I have done wrong?</p>