please try this.
from matplotlib.pyplot import *
plot([1,2,3], label="very loooooooong label")
plot([3,2,1], label="very loooooooong label2")
legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
The code puts a legend with very long label text outside the figure.
When drawing only the beginning of the legend is visible.
Is there a way to automatically correct the area of figure and resize it
such that every box drawn is visible?
I know I can overcome this issue by using subplots. But this would only
work to a certain extend of the problem.