title: Octave: Add secondary y axis to existing plot
body: <p>I am using Octave 4.2.1 portable under Win 10.</p>
  
  <p>I have several plots in a single chart, with a single y axis, each one created with a <code>plot(...)</code> sentence.
  I want to add a plot in a secondary y axis to this existing plot, not creating from the beginning the two axes with <code>plotyy</code>, (<strong>EDIT</strong>) and being able to work all the same, e.g., adding a legend, etc.</p>
  
  <p><strong>What is the correct usage for this?</strong></p>
  
  <p>If I execute</p>
  
  <pre><code>plotyy(x, ysec) ;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>ax = gca ;
  plotyy(ax, x, ysec) ;
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>error: Invalid call to plotyy.  Correct usage is:    
   -- plotyy (X1, Y1, X2, Y2)
   -- plotyy (..., FUN)
   -- plotyy (..., FUN1, FUN2)
   -- plotyy (HAX, ...)
   -- [AX, H1, H2] = plotyy (...)
  </code></pre>
  
  <p><a href="https://la.mathworks.com/matlabcentral/answers/98907-how-can-i-add-a-second-y-axis-with-a-different-scale-in-a-plot-in-matlab-7-9-r2009b#answer_108254" rel="nofollow noreferrer">This</a> shows something similar for Matlab, but I am not sure all code that works with a secondary axis that would be created with <code>plotyy</code>, will work with an axis created this way as well.</p>