Creating matplotlib legend with dynamic number of columns
<p>I would like to create a legend in matplotlib with at max 5 entries per column. Right now, I can manually set the number of columns like so:</p>

<pre><code>leg = plt.legend(loc='best', fancybox=None, ncol=2)
</code></pre>

<p>How do I modify this so that at most 5 entries are allowed per column?</p>