title: Matplotlib legend, add items across columns instead of down
body: <p>For a simple plot below, is there a way to make matplotlib populate the legend so that it fills the rows left to right, instead of first column then second column?</p>
  
  <pre><code>&gt;&gt;&gt; from pylab import *
  &gt;&gt;&gt; x = arange(-2*pi, 2*pi, 0.1)
  &gt;&gt;&gt; plot(x, sin(x), label='Sine')
  &gt;&gt;&gt; plot(x, cos(x), label='Cosine')
  &gt;&gt;&gt; plot(x, arctan(x), label='Inverse tan')
  &gt;&gt;&gt; legend(loc=9,ncol=2)
  &gt;&gt;&gt; grid('on')
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/urF1l.png" alt="enter image description here"></p>