title: Plot single data with two Y axes (two units) in matplotlib
body: <p>I'm trying to plot a single time series, but want to represent it in two units on left and right axes. Here's what I have done so far. </p>
  
  <pre><code>fig, ax1 = plt.subplots()
  t = np.arange(1,50,1)
  s1 = np.sin(t)*20000+40000 #synthetic ts, but closer to my data 
  ax1.plot(t, s1, 'b-')
  
  ax1.set_xlabel('time')
  ax1.set_ylim(20000,70000)
  ax1.set_ylabel('km3/year')
  
  km3yearToSv=31.6887646*(1/1e6)
  
  ax2 = ax1.twinx()
  s2 = s1*km3yearToSv
  ax2.plot(t, s2, 'b-')
  ax2.set_ylim(20000*km3yearToSv,70000*km3yearToSv)
  ax2.set_ylabel('Sv')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/YTQ3A.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YTQ3A.png" alt="enter image description here"></a></p>
  
  <p>By adjusting the ylim(), I can get it to seem as a single line, but some aliasing can be seen. I would prefer if I don't have to plot the data twice.</p>
  
  <p>Any suggestions?</p>
  
  <p>UPDATE: Thanks, askewchan, for the perfect solution!</p>