Matplotlib, how to write annotation outside the drawing in data coords?
ax.annotate('MgII', xy=(2000.0, 10.5), xycoords='data', annotation_clip=False)
By default in data units the annotation is only drawn if it is in axes.
You might be better off using a blended transform:
trans = ax.get_xaxis_transform() # x in data untis, y in axes fraction
ann = ax.annotate('MgII', xy=(2000, 1.05 ), xycoords=trans)