Easily label line(s) using matplotlib. The code is heavily based on http://stackoverflow.com/questions/16992038/inline-labels-in-matplotlib (original code from ...
It adds automatic label positioning by preventing label bounding boxes from overlapping other lines and each other.