title: matplotlib: save multiple axis figure wrong
body: <p>I am trying to plot a twin figure. my code seems to work correctly in jupyter notebooks. the output figure of jupyter notebooks are as follows
  <a href="https://i.stack.imgur.com/eaISs.png" rel="nofollow noreferrer">jupyter notebook inline figure</a></p>
  
  <p>However, when I try to save the figure to file, my output figure is always wrong, no matter how I adjust the figure size by <code>figsize=(*,*)</code> keywords, I can not get the right results. my output to file are something like the below figure
  <a href="https://i.stack.imgur.com/A7CT9.png" rel="nofollow noreferrer">save to file</a></p>
  
  <p>my code as follow:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  fig1, (ax1,ax2) = plt.subplots(2,1)
  
  box1 = [0.1, 0.1, 0.8, 0.4]
  box2 = [0.1, 0.5, 0.8, 0.8]
  
  ax1.set_position(box1) #lower figure
  ax2.set_position(box2) #upper figure
  
  x=np.arange(10)
  y1=0*x
  y2=x+1
  
  ax1.plot(x,y1)
  ax2.plot(x,y2)
  ax1.set_xlim(0,9)
  ax2.set_xlim(0,9)
  ax2.set_xticklabels('')
  
  ax1.set_xlabel('ax1 x')
  ax1.set_ylabel('ax1 y')
  ax2.set_ylabel('ax2 x')
  ax2.set_title('titles')
  
  fig1.savefig('./1.png',dpi=200)
  fig1.show()
  </code></pre>
  
  <p>Thanks very much for any help.</p>