I also had this problem several times and use this workaround, adding dummy elements to the legend to fill the last column, if there are more elegant methods, I would also be very interested to hear about them.
import numpy as np import matplotlib.pylab as pl pl.figure() pl.plot(np.arange(10), np.random.random([10,5]), color='r', label='red') pl.plot(np.arange(10), np.random.random([10,5]), color='g', label='green') pl.plot(np.arange(10), np.random.random([10,5]), color='b', label='blue') pl.plot(np.arange(10), np.random.random([10,2]), color='k', label='black')

source share