title: Single colorbar for two subplots changes the size of one of the subplots
body: <p>I am trying to add a single <code>colorbar</code> for two <code>matshow</code>s using mainly the code at <a href="https://stackoverflow.com/questions/7875688/how-can-i-create-a-standard-colorbar-for-a-series-of-plots-in-python">here</a> and <a href="http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#colorbar-whose-height-or-width-in-sync-with-the-master-axes" rel="nofollow noreferrer">here</a>.</p>
  
  <p>My code is the following now, but the problem is that the colorbar moderates the size of the plot on the right. How can I prevent that?</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  from mpl_toolkits.axes_grid1 import make_axes_locatable
  # Generate some data that where each slice has a different range
  # (The overall range is from 0 to 2)
  data = np.random.random((2,10,10))
  data *= np.array([1.5, 2.0])[:,None,None]
  
  # Plot each slice as an independent subplot
  fig, axes = plt.subplots(nrows=1, ncols=2)
  for dat, ax in zip(data, axes.flat):
      # The vmin and vmax arguments specify the color limits
      im = ax.imshow(dat, vmin=0, vmax=2)
  
  # Make an axis for the colorbar on the right side
  divider = make_axes_locatable(ax)
  cax = divider.append_axes("right", size="5%", pad=0.05)
  fig.colorbar(im, cax=cax)
  plt.tight_layout()
  plt.show()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/jufx7.png" alt="enter image description here"></p>