title: Overcome ValueError for empty array
body: <p>In <a href="https://stackoverflow.com/questions/22853118/twiny-in-matplotlib-changes-the-y-axis-scale/22856984?noredirect=1#comment34952087_22856984">this discussion</a> I tried to fix an issue in plotting limits for y-axis, after the <code>twiny()</code> messes up my plot.</p>
  <p>I thought this:</p>
  <pre><code>ax.set_ylim([y.min()-0.05, y.max()+0.05])
  </code></pre>
  <p>was a good solution. And probably it is, for continuous set of data.
  As I said in that discussion, anyway, my data are noisy, and sometimes with gaps. So it happens that some plotted ranges have no data. In that case, naturally, the use of the <code>.min()</code> raises the error:</p>
  <pre><code>ValueError: zero-size array to reduction operation minimum which has no identity
  </code></pre>
  <p>because the array is empty. How to work around it, so that the code just does not care about putting limits on the y-axis? (Hoping that this is the only issue the empty array will cause)</p>