my duel with the legend is over. I won. :)

lol.

Finally found the magic parameter. borderaxespad.

import pylab,matplotlib

pylab.plot([1,2,3,4,5],[1,2,3,4,5],"bo",label="data")
ax = pylab.gca()

pylab.legend(bbox_to_anchor=(0,1),loc=2,borderaxespad=0)

# draw an X to make sure of coordinates.
ax.lines.append(matplotlib.lines.Line2D((0,1),(0,1),transform=ax.transAxes,color='blue'))
ax.lines.append(matplotlib.lines.Line2D((0,1),(1,0),transform=ax.transAxes,color='red'))

pylab.show()

I don't know how I missed that parameter after reading the docs 100 times. :frowning:

Sorry for bothering the list with something so trivial. I had a major
"can't see the forest through the trees" moment.

ยทยทยท

--
Daniel Hyams
dhyams@...287...