setting axis label offset from end of spine

I'm trying to change the position of the axis label so that it is a certain number of points off the end of the spine representing the x-axis. I'm trying to use the transform attribute and the offset_copy function to say "put the label 5 points right of the end of the spine". So far, my code looks something like:

xtrans=offset_copy(subplot.transData, subplot.figure, x=5, y=0, units='points')
subplot.xaxis.set_label_coords(subplot.get_xlim()[1], 0,transform=xtrans)

However, this doesn't handle the case where the spine representing the x-axis is not the same as the line y=0. Any ideas on how to construct the transform to say "5 points to the right of the right end of this given spine"?




Jason Grout