added function to write text to plot margins