title: How do I align gridlines for two y-axis scales using Matplotlib?
body: <p>I'm plotting two datasets with different units on the y-axis. Is there a way to make the ticks and gridlines aligned on both y-axes?</p>
  
  <p>The first image shows what I get, and the second image shows what I would like to get.</p>
  
  <p>This is the code I'm using to plot:</p>
  
  <pre><code>import seaborn as sns
  import numpy as np
  import pandas as pd
  
  np.random.seed(0)
  fig = plt.figure()
  ax1 = fig.add_subplot(111)
  ax1.plot(pd.Series(np.random.uniform(0, 1, size=10)))
  ax2 = ax1.twinx()
  ax2.plot(pd.Series(np.random.uniform(10, 20, size=10)), color='r')
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/ahFOc.png" alt="Example of unwanted behavior"></p>
  
  <p><img src="https://i.stack.imgur.com/I1auM.png" alt="Example of wanted behavior"></p>