title: Create a scaled secondary y-axis in Matplotlib
body: <p>The objective is to plot a scatter plot and create secondary y-axis. Here, the secondary y-axis is just scaled copy of the original scatter plot.</p>
  <p>Assume the scaling can be calculated
  y2=y1/2.5</p>
  <p>where, <code>y1</code> and <code>y2</code> is the <code>y</code> axis from the scatter plot,and scaled copy of the original scatter plot, respectively.</p>
  <p>This can be visualized as below.</p>
  <p><a href="https://i.stack.imgur.com/ysMi7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ysMi7.png" alt="enter image description here" /></a></p>
  <p>However, using the code below,</p>
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  x, y = np.random.random((2,50))
  
  fig, ax1 = plt.subplots()
  
  ax1.scatter(x, y*10, c='b')
  
  ax2 = ax1.twinx()
  y2=y/2.5
  ax2.plot(1, 1, 'w-')
  ax1.set_xlabel('X1_z')
  ax1.set_ylabel('x1_y', color='g')
  ax2.set_ylabel('x2_y', color='r')
  </code></pre>
  <p>which produced</p>
  <p><a href="https://i.stack.imgur.com/z9vHV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z9vHV.png" alt="enter image description here" /></a></p>
  <p>There are three issues</p>
  <ul>
  <li>The secondary y-axis is not scaled properly</li>
  <li>As expected but not intended the existence  multiple horizontal line root from the secondary y-axis</li>
  <li>Is there a possible way to create the scaled y-axis without the need of the line <code>ax2.plot(1, 1, 'w-')</code></li>
  </ul>
  <p>May I know how to handle this?</p>